mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-24 15:13:58 -06:00
Ported point_along_segment(), Polyline::length(), Polyline::clip_end() to XS
This commit is contained in:
parent
26a18a2a52
commit
29b83517cb
12 changed files with 64 additions and 57 deletions
|
@ -42,6 +42,18 @@ Line::midpoint() const
|
|||
return new Point ((this->a.x + this->b.x) / 2.0, (this->a.y + this->b.y) / 2.0);
|
||||
}
|
||||
|
||||
Point*
|
||||
Line::point_at(double distance) const
|
||||
{
|
||||
double len = this->length();
|
||||
Point* p = new Point(this->a);
|
||||
if (this->a.x != this->b.x)
|
||||
p->x = this->a.x + (this->b.x - this->a.x) * distance / len;
|
||||
if (this->a.y != this->b.y)
|
||||
p->y = this->a.y + (this->b.y - this->a.y) * distance / len;
|
||||
return p;
|
||||
}
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
void
|
||||
Line::from_SV(SV* line_sv)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue