mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 10:32:20 +00:00
Ported point_along_segment(), Polyline::length(), Polyline::clip_end() to XS
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user