intersection.h
Go to the documentation of this file.00001 #ifndef VVELIB_GEOMETRY_INTERSECTION_H
00002 #define VVELIB_GEOMETRY_INTERSECTION_H
00003
00010 #include <config.h>
00011 #include <geometry/geometry.h>
00012 #include <vector>
00013
00014 namespace geometry
00015 {
00016
00034 bool planeLineIntersection(Point3d &u, double &s,
00035 const Point3d& p, const Point3d& n, const Point3d& u1, const Point3d& u2);
00036
00037
00045 bool pointInTriangle(const Point2d& p,
00046 const Point2d& p1, const Point2d& p2, const Point2d& p3);
00047
00048
00061 bool pointInTriangle(Point3d& u, double &s,
00062 const Point3d& p, const Point3d& p1, const Point3d& p2, const Point3d& p3);
00063
00078 bool lineTriangleIntersection(Point3d& u, double& s,
00079 const Point3d& p1, const Point3d& p2,
00080 const Point3d& tr1, const Point3d& tr2, const Point3d& tr3);
00081
00085 bool pointInPolygon(const Point2d& p, const std::vector<Point2d>& polygon);
00086
00087 template <typename PointContainer>
00088 bool pointInPolygon(const Point2d& p, const PointContainer& polygon)
00089 {
00090 std::vector<Point2d> pol(polygon.begin(), polygon.end());
00091 return pointInPolygon(p, pol);
00092 }
00093
00102 bool lineSegmentIntersection(Point2d& u,
00103 const Point2d& p1, const Point2d& p2,
00104 const Point2d& p, const Point2d& n);
00105
00114 bool lineLineIntersection(Point2d& u,
00115 const Point2d& p1, const Point2d& u1,
00116 const Point2d& p2, const Point2d& u2);
00117
00127 bool segmentSegmentIntersection(Point2d& u,
00128 const Point2d& p1, const Point2d& p2,
00129 const Point2d& q1, const Point2d& q2);
00130
00131 };
00132
00133 #endif // VVELIB_GEOMETRY_INTERSECTION_H