BestPoint.h
Go to the documentation of this file.00001 #ifndef BESTPOINT_H_
00002 #define BESTPOINT_H_
00003
00004 #include "math/Vector3.h"
00005 #include "selectable.h"
00006 #include "Manipulatables.h"
00007
00008 enum clipcull_t
00009 {
00010 eClipCullNone, eClipCullCW, eClipCullCCW,
00011 };
00012
00013 class Segment3D
00014 {
00015 typedef Vector3 point_type;
00016
00017 public:
00018 Segment3D (const point_type& _p0, const point_type& _p1) :
00019 p0(_p0), p1(_p1)
00020 {
00021 }
00022
00023 point_type p0, p1;
00024 };
00025
00026 typedef Vector3 Point3D;
00027
00028 inline double triangle_signed_area_XY (const Vector3& p0, const Vector3& p1, const Vector3& p2)
00029 {
00030 return ((p1[0] - p0[0]) * (p2[1] - p0[1])) - ((p2[0] - p0[0]) * (p1[1] - p0[1]));
00031 }
00032
00033
00034 Point3D segment_closest_point_to_point (const Segment3D& segment, const Point3D& point);
00035
00036 typedef Vector3 point_t;
00037 typedef const Vector3* point_iterator_t;
00038
00039
00040
00041 bool point_test_polygon_2d (const point_t& P, point_iterator_t start, point_iterator_t finish);
00042
00043 void BestPoint (std::size_t count, Vector4 clipped[9], SelectionIntersection& best, clipcull_t cull);
00044
00045 void LineStrip_BestPoint (const Matrix4& local2view, const PointVertex* vertices, const std::size_t size,
00046 SelectionIntersection& best);
00047 void LineLoop_BestPoint (const Matrix4& local2view, const PointVertex* vertices, const std::size_t size,
00048 SelectionIntersection& best);
00049 void Line_BestPoint (const Matrix4& local2view, const PointVertex vertices[2], SelectionIntersection& best);
00050
00051 void Circle_BestPoint (const Matrix4& local2view, clipcull_t cull, const PointVertex* vertices, const std::size_t size,
00052 SelectionIntersection& best);
00053 void Quad_BestPoint (const Matrix4& local2view, clipcull_t cull, const PointVertex* vertices,
00054 SelectionIntersection& best);
00055
00056 typedef FlatShadedVertex* FlatShadedVertexIterator;
00057 void Triangles_BestPoint (const Matrix4& local2view, clipcull_t cull, FlatShadedVertexIterator first,
00058 FlatShadedVertexIterator last, SelectionIntersection& best);
00059
00060 #endif