36#ifndef AVOID_GEOMETRY_H
37#define AVOID_GEOMETRY_H
52 const Point& s1,
const Point& s2,
bool& seenIntersectionAtEndpoint);
53extern bool inPoly(
const Polygon& poly,
const Point& q,
bool countBorder =
true);
54extern bool inPolyGen(
const PolygonInterface& poly,
const Point& q);
60 const double tolerance = 0.0);
62 const double tolerance = 0.0);
80 const double maybeZero = 0.0)
82 COLA_ASSERT(maybeZero >= 0);
84 double area2 = ((b.
x - a.
x) * (
c.y - a.
y)) -
85 ((
c.x - a.
x) * (b.
y - a.
y));
87 if (area2 < (-maybeZero))
91 else if (area2 > maybeZero)
101 double ux =
c.
x - a.
x,
105 scalarProj = ux * vx + uy * vy;
106 scalarProj /= ux * ux + uy * uy;
108 p.
x = scalarProj * ux + a.
x;
109 p.
y = scalarProj * uy + a.
y;
120 const Point& b1,
const Point& b2,
double *x,
double *y);
122 const Point& b1,
const Point& b2,
double *x,
double *y);
pair< double, double > Point
The Point class defines a point in the plane.
Contains the interface for various geometry types and classes.
libavoid: Object-avoiding orthogonal and polyline connector routing library.
double manhattanDist(const Point &a, const Point &b)
int segmentIntersectPoint(const Point &a1, const Point &a2, const Point &b1, const Point &b2, double *x, double *y)
bool inPoly(const Polygon &poly, const Point &q, bool countBorder)
bool inBetween(const Point &a, const Point &b, const Point &c)
static const int DO_INTERSECT
static Point projection(const Point &a, const Point &b, const Point &c)
static const int DONT_INTERSECT
bool colinear(const Point &a, const Point &b, const Point &c, const double tolerance)
double angle(const Point &a, const Point &b, const Point &c)
static const int PARALLEL
bool segmentShapeIntersect(const Point &e1, const Point &e2, const Point &s1, const Point &s2, bool &seenIntersectionAtEndpoint)
double euclideanDist(const Point &a, const Point &b)
int rayIntersectPoint(const Point &a1, const Point &a2, const Point &b1, const Point &b2, double *x, double *y)
static int vecDir(const Point &a, const Point &b, const Point &c, const double maybeZero=0.0)
bool inValidRegion(bool IgnoreRegions, const Point &a0, const Point &a1, const Point &a2, const Point &b)
double rotationalAngle(const Point &p)
bool pointOnLine(const Point &a, const Point &b, const Point &c, const double tolerance)
int cornerSide(const Point &c1, const Point &c2, const Point &c3, const Point &p)
double totalLength(const Polygon &poly)
bool inPolyGen(const PolygonInterface &argpoly, const Point &q)
bool segmentIntersect(const Point &a, const Point &b, const Point &c, const Point &d)