00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00041 #ifndef __vtkPointsProjectedHull_h
00042 #define __vtkPointsProjectedHull_h
00043
00044 #include "vtkPoints.h"
00045
00046 class VTK_PARALLEL_EXPORT vtkPointsProjectedHull : public vtkPoints
00047 {
00048 vtkTypeRevisionMacro(vtkPointsProjectedHull, vtkPoints);
00049
00050 public:
00051 void PrintSelf(ostream& os, vtkIndent indent);
00052
00053 static vtkPointsProjectedHull *New();
00054
00058 int rectangleIntersectionX(vtkPoints *R);
00059
00063 int rectangleIntersectionX(float ymin, float ymax, float zmin, float zmax);
00064 int rectangleIntersectionX(double ymin, double ymax, double zmin, double zmax);
00065
00068 int rectangleIntersectionY(vtkPoints *R);
00069
00073 int rectangleIntersectionY(float zmin, float zmax, float xmin, float xmax);
00074 int rectangleIntersectionY(double zmin, double zmax, double xmin, double xmax);
00075
00078 int rectangleIntersectionZ(vtkPoints *R);
00079
00083 int rectangleIntersectionZ(float xmin, float xmax, float ymin, float ymax);
00084 int rectangleIntersectionZ(double xmin, double xmax, double ymin, double ymax);
00085
00090 int GetCcwHullX(float *pts, int len);
00091 int GetCcwHullX(double *pts, int len);
00092
00097 int GetCcwHullY(float *pts, int len);
00098 int GetCcwHullY(double *pts, int len);
00099
00104 int GetCcwHullZ(float *pts, int len);
00105 int GetCcwHullZ(double *pts, int len);
00106
00110 int GetSizeCcwHullX();
00111
00115 int GetSizeCcwHullY();
00116
00120 int GetSizeCcwHullZ();
00121
00122 void Initialize();
00123 void Reset(){this->Initialize();}
00124
00128 void Update();
00129
00130 protected:
00131
00132 vtkPointsProjectedHull();
00133 ~vtkPointsProjectedHull();
00134
00135 private:
00136
00137 int rectangleIntersection(double hmin, double hmax,
00138 double vmin, double vmax, int direction);
00139 int grahamScanAlgorithm(int direction);
00140 void getPoints();
00141 int rectangleBoundingBoxIntersection(double hmin, double hmax,
00142 double vmin, double vmax, int direction);
00143 int rectangleOutside(double hmin, double hmax,
00144 double vmin, double vmax, int direction);
00145
00146 int rectangleOutside1DPolygon(double hmin, double hmax,
00147 double vmin, double vmax, int dir);
00148
00149 void initFlags();
00150 void clearAllocations();
00151
00152
00153 static int removeExtras(double *pts, int n);
00154 static double distance(double *p1, double *p2);
00155 static int positionInHull(double *base, double *top, double *pt);
00156 static int outsideLine(double hmin, double hmax,
00157 double vmin, double vmax, double *p0, double *p1, double *insidePt);
00158 static int outsideHorizontalLine(double vmin, double vmax,
00159 double *p0, double *p1, double *insidePt);
00160 static int outsideVerticalLine(double hmin, double hmax, double *p0,
00161 double *p1, double *insidePt);
00162
00163 double *Pts;
00164 int Npts;
00165 vtkTimeStamp PtsTime;
00166
00167 double *ccwHull[3];
00168 float hullBBox[3][4];
00169 int hullSize[3];
00170 vtkTimeStamp hullTime[3];
00171
00172 vtkPointsProjectedHull(const vtkPointsProjectedHull&);
00173 void operator=(const vtkPointsProjectedHull&);
00174 };
00175 #endif
00176
00177