Incomplete work for porting simplify() to XS

This commit is contained in:
Alessandro Ranellucci
2013-11-21 20:25:24 +01:00
parent 7475762a27
commit 518798beb3
24 changed files with 121 additions and 41 deletions

View File

@@ -76,12 +76,18 @@ Point::distance_to(const Point* point) const
double
Point::distance_to(const Line* line) const
{
if (line->a.coincides_with(&line->b)) return this->distance_to(&line->a);
return this->distance_to(*line);
}
double
Point::distance_to(const Line &line) const
{
if (line.a.coincides_with(&line.b)) return this->distance_to(&line.a);
double n = (line->b.x - line->a.x) * (line->a.y - this->y)
- (line->a.x - this->x) * (line->b.y - line->a.y);
double n = (line.b.x - line.a.x) * (line.a.y - this->y)
- (line.a.x - this->x) * (line.b.y - line.a.y);
return abs(n) / line->length();
return abs(n) / line.length();
}
#ifdef SLIC3RXS