00001
00026 #ifndef INC_GRE_3DCLIP_H
00027 #define INC_GRE_3DCLIP_H
00028
00029 #ifndef INC_MI32_POINT_H
00030 #include <mi32/point.h>
00031 #endif
00032
00033 #ifndef INC_MI32_DOUBLEAR_H
00034 #include <mi32/doublear.h>
00035 #endif
00036
00037 namespace GRE {
00038
00043 class CLIPPING3D {
00044 public:
00045
00046 enum PLANE {
00047 PLANE_X_P_W = 0,
00048 PLANE_X_M_W = 1,
00049 PLANE_Y_P_W = 2,
00050 PLANE_Y_M_W = 3,
00051 PLANE_Z_P_W = 4,
00052 PLANE_Z_M_W = 5,
00053 PLANE_Count = 6
00054 };
00055
00059 static bool ClipPoint (
00060 DPOINT3DH& point
00061 );
00062
00067 static bool ClipSegment (
00068 DPOINT3DH& point1,
00069 DPOINT3DH& point2
00070 );
00071
00074
00077 static bool ClipPolygon (
00078 const DOUBLE_ARRAY<DPOINT3DH>& input,
00079 DOUBLE_ARRAY<DPOINT3DH>& output
00080 );
00081
00082 private:
00083 #ifndef GENERATING_DOXYGEN_OUTPUT
00084
00085 static bool Check (
00086 const double w1,
00087 const double w2,
00088 double& tmin,
00089 double& tmax
00090 );
00091
00092 static bool ClipToPlane (
00093 const PLANE plane,
00094 const DOUBLE_ARRAY<DPOINT3DH>& input,
00095 DOUBLE_ARRAY<DPOINT3DH>& output
00096 );
00097
00098 static bool CheckAbove (
00099 const double value
00100 ) { return (value > 0.0); }
00101
00102 static bool AbovePlane (
00103 const PLANE plane,
00104 const DPOINT3DH& point
00105 );
00106
00108 static DPOINT3DH IntersectPlane (
00109 const PLANE plane,
00110 const DPOINT3DH& point1,
00111 const DPOINT3DH& point2
00112 );
00113
00114 static bool Intersect (
00115 const double w1,
00116 const double w2,
00117 double& t
00118 );
00119
00120 #endif
00121 };
00122
00123 };
00124
00125 #endif
00126