Optimizations for better usage of XS code

This commit is contained in:
Alessandro Ranellucci 2013-08-29 01:36:42 +02:00
parent 9254ff9704
commit 5d6fd7f4d9
22 changed files with 68 additions and 42 deletions

View file

@ -14,6 +14,12 @@ ExtrusionPath::first_point() const
return &(this->polyline.points.front());
}
const Point*
ExtrusionPath::last_point() const
{
return &(this->polyline.points.back());
}
ExtrusionPath*
ExtrusionLoop::split_at_index(int index)
{

View file

@ -39,6 +39,7 @@ class ExtrusionPath : public ExtrusionEntity
Polyline polyline;
void reverse();
const Point* first_point() const;
const Point* last_point() const;
};
class ExtrusionLoop : public ExtrusionEntity

View file

@ -36,6 +36,12 @@ Line::length() const
return this->a.distance_to(&(this->b));
}
Point*
Line::midpoint() const
{
return new Point ((this->a.x + this->b.x) / 2.0, (this->a.y + this->b.y) / 2.0);
}
void
Line::from_SV(SV* line_sv)
{

View file

@ -23,6 +23,7 @@ class Line
void rotate(double angle, Point* center);
void reverse();
double length() const;
Point* midpoint() const;
};
typedef std::vector<Line> Lines;

View file

@ -38,6 +38,12 @@ MultiPoint::first_point() const
return &(this->points.front());
}
const Point*
MultiPoint::last_point() const
{
return &(this->points.back());
}
void
MultiPoint::from_SV(SV* poly_sv)
{

View file

@ -20,6 +20,7 @@ class MultiPoint
void rotate(double angle, Point* center);
void reverse();
const Point* first_point() const;
const Point* last_point() const;
};
}