00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00031 #ifndef __vtkPointsProjectedHull_h
00032 #define __vtkPointsProjectedHull_h
00033
00034 #include "vtkPoints.h"
00035
00036 class VTK_GRAPHICS_EXPORT vtkPointsProjectedHull : public vtkPoints
00037 {
00038 vtkTypeRevisionMacro(vtkPointsProjectedHull, vtkPoints);
00039
00040 public:
00041 void PrintSelf(ostream& os, vtkIndent indent);
00042
00043 static vtkPointsProjectedHull *New();
00044
00048 int RectangleIntersectionX(vtkPoints *R);
00049
00053 int RectangleIntersectionX(float ymin, float ymax, float zmin, float zmax);
00054 int RectangleIntersectionX(double ymin, double ymax, double zmin, double zmax);
00055
00058 int RectangleIntersectionY(vtkPoints *R);
00059
00063 int RectangleIntersectionY(float zmin, float zmax, float xmin, float xmax);
00064 int RectangleIntersectionY(double zmin, double zmax, double xmin, double xmax);
00065
00068 int RectangleIntersectionZ(vtkPoints *R);
00069
00073 int RectangleIntersectionZ(float xmin, float xmax, float ymin, float ymax);
00074 int RectangleIntersectionZ(double xmin, double xmax, double ymin, double ymax);
00075
00080 int GetCCWHullX(float *pts, int len);
00081 int GetCCWHullX(double *pts, int len);
00082
00087 int GetCCWHullY(float *pts, int len);
00088 int GetCCWHullY(double *pts, int len);
00089
00094 int GetCCWHullZ(float *pts, int len);
00095 int GetCCWHullZ(double *pts, int len);
00096
00100 int GetSizeCCWHullX();
00101
00105 int GetSizeCCWHullY();
00106
00110 int GetSizeCCWHullZ();
00111
00112 void Initialize();
00113 void Reset(){this->Initialize();}
00114
00118 void Update();
00119
00120 protected:
00121
00122 vtkPointsProjectedHull();
00123 ~vtkPointsProjectedHull();
00124
00125 private:
00126
00127 int RectangleIntersection(double hmin, double hmax,
00128 double vmin, double vmax, int direction);
00129 int GrahamScanAlgorithm(int direction);
00130 void GetPoints();
00131 int RectangleBoundingBoxIntersection(double hmin, double hmax,
00132 double vmin, double vmax, int direction);
00133 int RectangleOutside(double hmin, double hmax,
00134 double vmin, double vmax, int direction);
00135
00136 int RectangleOutside1DPolygon(double hmin, double hmax,
00137 double vmin, double vmax, int dir);
00138
00139 void InitFlags();
00140 void ClearAllocations();
00141
00142
00143 static int RemoveExtras(double *pts, int n);
00144 static double Distance(double *p1, double *p2);
00145 static int PositionInHull(double *base, double *top, double *pt);
00146 static int OutsideLine(double hmin, double hmax,
00147 double vmin, double vmax, double *p0, double *p1, double *insidePt);
00148 static int OutsideHorizontalLine(double vmin, double vmax,
00149 double *p0, double *p1, double *insidePt);
00150 static int OutsideVerticalLine(double hmin, double hmax, double *p0,
00151 double *p1, double *insidePt);
00152
00153 double *Pts;
00154 int Npts;
00155 vtkTimeStamp PtsTime;
00156
00157 double *CCWHull[3];
00158 float HullBBox[3][4];
00159 int HullSize[3];
00160 vtkTimeStamp HullTime[3];
00161
00162 vtkPointsProjectedHull(const vtkPointsProjectedHull&);
00163 void operator=(const vtkPointsProjectedHull&);
00164 };
00165 #endif
00166
00167