VTK
dox/Common/DataModel/vtkPointsProjectedHull.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkPointsProjectedHull.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 /*----------------------------------------------------------------------------
00016  Copyright (c) Sandia Corporation
00017  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
00018 ----------------------------------------------------------------------------*/
00019 
00031 #ifndef __vtkPointsProjectedHull_h
00032 #define __vtkPointsProjectedHull_h
00033 
00034 #include "vtkCommonDataModelModule.h" // For export macro
00035 #include "vtkPoints.h"
00036 
00037 class VTKCOMMONDATAMODEL_EXPORT vtkPointsProjectedHull : public vtkPoints
00038 {
00039     vtkTypeMacro(vtkPointsProjectedHull, vtkPoints);
00040 
00041 public:
00042     void PrintSelf(ostream& os, vtkIndent indent);
00043 
00044     static vtkPointsProjectedHull *New();
00045 
00049     int RectangleIntersectionX(vtkPoints *R);
00050 
00054     int RectangleIntersectionX(float ymin, float ymax, float zmin, float zmax);
00055     int RectangleIntersectionX(double ymin, double ymax, double zmin, double zmax);
00056 
00059     int RectangleIntersectionY(vtkPoints *R);
00060 
00064     int RectangleIntersectionY(float zmin, float zmax, float xmin, float xmax);
00065     int RectangleIntersectionY(double zmin, double zmax, double xmin, double xmax);
00066 
00069     int RectangleIntersectionZ(vtkPoints *R);
00070 
00074     int RectangleIntersectionZ(float xmin, float xmax, float ymin, float ymax);
00075     int RectangleIntersectionZ(double xmin, double xmax, double ymin, double ymax);
00076 
00081     int GetCCWHullX(float *pts, int len);
00082     int GetCCWHullX(double *pts, int len);
00083 
00088     int GetCCWHullY(float *pts, int len);
00089     int GetCCWHullY(double *pts, int len);
00090 
00095     int GetCCWHullZ(float *pts, int len);
00096     int GetCCWHullZ(double *pts, int len);
00097 
00101     int GetSizeCCWHullX();
00102 
00106     int GetSizeCCWHullY();
00107 
00111     int GetSizeCCWHullZ();
00112 
00113     void Initialize();
00114     void Reset(){this->Initialize();}
00115 
00119     void Update();
00120 
00121 protected:
00122 
00123     vtkPointsProjectedHull();
00124     ~vtkPointsProjectedHull();
00125 
00126 private:
00127 
00128   int RectangleIntersection(double hmin, double hmax,
00129                             double vmin, double vmax, int direction);
00130   int GrahamScanAlgorithm(int direction);
00131   void GetPoints();
00132   int RectangleBoundingBoxIntersection(double hmin, double hmax,
00133                             double vmin, double vmax, int direction);
00134   int RectangleOutside(double hmin, double hmax,
00135                             double vmin, double vmax, int direction);
00136 
00137   int RectangleOutside1DPolygon(double hmin, double hmax,
00138                             double vmin, double vmax, int dir);
00139 
00140   void InitFlags();
00141   void ClearAllocations();
00142 
00143 
00144   static int RemoveExtras(double *pts, int n);
00145   static double Distance(double *p1, double *p2);
00146   static int PositionInHull(double *base, double *top, double *pt);
00147   static int OutsideLine(double hmin, double hmax,
00148            double vmin, double vmax, double *p0, double *p1, double *insidePt);
00149   static int OutsideHorizontalLine(double vmin, double vmax,
00150            double *p0, double *p1, double *insidePt);
00151   static int OutsideVerticalLine(double hmin, double hmax, double *p0,
00152            double *p1, double *insidePt);
00153 
00154   double *Pts;
00155   int Npts;
00156   vtkTimeStamp PtsTime;
00157 
00158   double *CCWHull[3];
00159   float HullBBox[3][4];
00160   int HullSize[3];
00161   vtkTimeStamp HullTime[3];
00162 
00163   vtkPointsProjectedHull(const vtkPointsProjectedHull&); // Not implemented
00164   void operator=(const vtkPointsProjectedHull&); // Not implemented
00165 };
00166 #endif
00167 
00168