#include <Line2D.h>
Public Member Functions | |
Point2D | intersect (const Line2D &o, bool &ok) const |
Line2D (double c=0.0) | |
Line2D (double b, double c) | |
Line2D (double x1, double y1, double az) | |
Line2D (const Line2D &o) | |
~Line2D () | |
Protected Attributes | |
double | _a |
double | _b |
double | _c |
QGpCoreTools::Line2D::Line2D | ( | double | c = 0.0 | ) |
QGpCoreTools::Line2D::Line2D | ( | double | b, |
double | c | ||
) |
QGpCoreTools::Line2D::Line2D | ( | double | x1, |
double | y1, | ||
double | az | ||
) |
QGpCoreTools::Line2D::Line2D | ( | const Line2D & | o | ) |
QGpCoreTools::Line2D::~Line2D | ( | ) | [inline] |
{}
Point2D QGpCoreTools::Line2D::intersect | ( | const Line2D & | o, |
bool & | ok | ||
) | const |
Returns interstection between this line and line o. If no intersection is found, ok is set to false.
References _a, _b, _c, QGpCoreTools::Point2D::setX(), QGpCoreTools::Point2D::setY(), TRACE, and QGpCoreTools::Point2D::x().
Referenced by QGpCoreTools::PointLocate::position().
{ TRACE; Point2D inter(0, 0); if(_a==o._a && _b==o._b) { // Either no intersection or infinity of intersections ok=false; } else if(_a==0) { // this is vertical inter.setX(_c); // _b is 1 inter.setY(o._c - o._b * inter.x()); // o._a is 1 ok=true; } else if(o._a==0) { // o is vertical inter.setX(o._c); // o._b is 1 inter.setY(_c - _b * inter.x()); // _a is 1 ok=true; } else { // _a and o._a are 1 inter.setX((_c - o._c)/(_b - o._b)); inter.setY(_c - _b * inter.x()); ok=true; } return inter; }
double QGpCoreTools::Line2D::_a [protected] |
Referenced by intersect(), and Line2D().
double QGpCoreTools::Line2D::_b [protected] |
Referenced by intersect(), and Line2D().
double QGpCoreTools::Line2D::_c [protected] |
Referenced by intersect(), and Line2D().