Use a more robust parallelism detection

This commit is contained in:
Alessandro Ranellucci 2014-05-02 13:26:59 +02:00
parent fce669dea0
commit 0a88492fdc
5 changed files with 45 additions and 2 deletions

View file

@ -111,6 +111,17 @@ Line::direction() const
: atan2;
}
bool
Line::parallel_to(double angle) const {
double diff = abs(this->direction() - angle);
return (diff < EPSILON) || (abs(diff - PI) < EPSILON);
}
bool
Line::parallel_to(const Line &line) const {
return this->parallel_to(line.direction());
}
Vector
Line::vector() const
{