Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 #ifndef _PRIMITIVEPOSITIONING_H
00046 #define _PRIMITIVEPOSITIONING_H
00047 
00048 #include <vector>
00049 #include "gpc.h"
00050 
00051 namespace vrender
00052 {
00053         class Primitive ;
00054 
00055         
00056 
00057         class PrimitivePositioning
00058         {
00059                 public:
00060                         typedef enum { Independent = 0x0,
00061                                                                 Upper           = 0x1,
00062                                                                 Lower           = 0x2 } RelativePosition ;
00063 
00064                         static int computeRelativePosition(const Primitive *p1,const Primitive *p2) ;
00065 
00066                         static void splitPrimitive(Primitive *P,const NVector3& v,double c,Primitive *& prim_up,Primitive *& prim_lo) ;
00067 
00068                         static void split(Segment *S,   const NVector3& v,double C,Primitive * & P_plus,Primitive * & P_moins) ;
00069                         static void split(Point *P,     const NVector3& v,double C,Primitive * & P_plus,Primitive * & P_moins) ;
00070                         static void split(Polygone *P,const NVector3& v,double C,Primitive * & P_plus,Primitive * & P_moins) ;
00071 
00072                 private:
00073                         static void getsigns(const Primitive *P,const NVector3& v,
00074                                                                                 double C,std::vector<int>& signs,std::vector<double>& zvals,
00075                                                                                 int& Smin,int& Smax,double I_EPS) ;
00076 
00077                         static int computeRelativePosition(const Polygone  *p1,const Polygone  *p2) ;
00078                         static int computeRelativePosition(const Polygone  *p1,const Segment   *p2) ;
00079                         static int computeRelativePosition(const Polygone  *p1,const Point     *p2) ;
00080                         static int computeRelativePosition(const Segment   *p1,const Segment   *p2) ;
00081 
00082                         
00083                         
00084 
00085                         static bool pointOutOfPolygon_XY(const Vector3&  P,const Polygone *Q,double I_EPS) ;
00086                         static bool intersectSegments_XY(const Vector2& P1,const Vector2& Q1,
00087                                                                                                                 const Vector2& P2,const Vector2& Q2,
00088                                                                                                                 double I_EPS,double & t1,double & t2) ;
00089                         static gpc_polygon createGPCPolygon_XY(const Polygone *P) ;
00090 
00091 
00092                         static int inverseRP(int) ;
00093 
00094                         
00095                         
00096                         
00097 
00098                         static double _EPS ;
00099         };
00100 }
00101 
00102 #endif