VTK
vtkBoundedPlanePointPlacer.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBoundedPlanePointPlacer.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
28 #ifndef __vtkBoundedPlanePointPlacer_h
29 #define __vtkBoundedPlanePointPlacer_h
30 
31 #include "vtkPointPlacer.h"
32 
33 class vtkPlane;
34 class vtkPlaneCollection;
35 class vtkPlanes;
36 class vtkRenderer;
37 
38 
40 {
41 public:
44 
46 
48  void PrintSelf(ostream& os, vtkIndent indent);
50 
52 
55  vtkSetClampMacro(ProjectionNormal,int,
58  vtkGetMacro(ProjectionNormal,int);
59  void SetProjectionNormalToXAxis()
60  { this->SetProjectionNormal(vtkBoundedPlanePointPlacer::XAxis); }
61  void SetProjectionNormalToYAxis()
62  { this->SetProjectionNormal(vtkBoundedPlanePointPlacer::YAxis); }
63  void SetProjectionNormalToZAxis()
64  { this->SetProjectionNormal(vtkBoundedPlanePointPlacer::ZAxis); }
65  void SetProjectionNormalToOblique()
66  { this->SetProjectionNormal(vtkBoundedPlanePointPlacer::Oblique); }
68 
71  void SetObliquePlane(vtkPlane *);
72 
74 
78  void SetProjectionPosition(double position);
79  vtkGetMacro(ProjectionPosition, double);
81 
83 
89  void AddBoundingPlane(vtkPlane *plane);
90  void RemoveBoundingPlane(vtkPlane *plane);
91  void RemoveAllBoundingPlanes();
92  virtual void SetBoundingPlanes(vtkPlaneCollection*);
93  vtkGetObjectMacro(BoundingPlanes,vtkPlaneCollection);
94  void SetBoundingPlanes(vtkPlanes *planes);
96 
97 //BTX
98  enum
99  {
100  XAxis=0,
103  Oblique
104  };
105 //ETX
106 
108 
118  double displayPos[2],
119  double worldPos[3],
120  double worldOrient[9] );
122 
124 
127  virtual int ComputeWorldPosition( vtkRenderer *ren,
128  double displayPos[2],
129  double refWorldPos[3],
130  double worldPos[3],
131  double worldOrient[9] );
133 
136  int ValidateWorldPosition( double worldPos[3] );
137 
138  // Descrption:
139  // Orientationation is ignored, and the above method
140  // is called instead.
141  int ValidateWorldPosition( double worldPos[3],
142  double worldOrient[9]);
143 
145 
149  virtual int UpdateWorldPosition( vtkRenderer *ren,
150  double worldPos[3],
151  double worldOrient[9] );
153 
154 
155 protected:
158 
159  // Indicates the projection normal as lying along the
160  // XAxis, YAxis, ZAxis, or Oblique. For X, Y, and Z axes,
161  // the projection normal is assumed to be anchored at
162  // (0,0,0)
164 
165  // Indicates a distance from the origin of the projection
166  // normal where the project plane will be placed
168 
169  // If the ProjectionNormal is oblique, this is the oblique
170  // plane
172 
173  // A collection of planes used to bound the projection
174  // plane
176 
177  // Internal method for getting the project normal as a vector
178  void GetProjectionNormal( double normal[3] );
179 
180  // Internal method for getting the origin of the
181  // constraining plane as a 3-tuple
182  void GetProjectionOrigin( double origin[3] );
183 
184  // Internal method for getting the orientation of
185  // the projection plane
186  void GetCurrentOrientation( double worldOrient[9] );
187 
188  // Calculate the distance of a point from the Object. Negative
189  // values imply that the point is outside. Positive values imply that it is
190  // inside. The closest point to the object is returned in closestPt.
191  static double GetDistanceFromObject( double pos[3],
192  vtkPlaneCollection * pc,
193  double closestPt[3]);
194 
195 private:
196  vtkBoundedPlanePointPlacer(const vtkBoundedPlanePointPlacer&); //Not implemented
197  void operator=(const vtkBoundedPlanePointPlacer&); //Not implemented
198 };
199 
200 #endif