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 =========================================================================*/
26 #ifndef vtkBoundedPlanePointPlacer_h
27 #define vtkBoundedPlanePointPlacer_h
28 
29 #include "vtkInteractionWidgetsModule.h" // For export macro
30 #include "vtkPointPlacer.h"
31 
32 class vtkPlane;
33 class vtkPlaneCollection;
34 class vtkPlanes;
35 class vtkRenderer;
36 
37 
38 class VTKINTERACTIONWIDGETS_EXPORT vtkBoundedPlanePointPlacer : public vtkPointPlacer
39 {
40 public:
45 
47 
51  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
53 
55 
60  vtkSetClampMacro(ProjectionNormal,int,
63  vtkGetMacro(ProjectionNormal,int);
65  { this->SetProjectionNormal(vtkBoundedPlanePointPlacer::XAxis); }
67  { this->SetProjectionNormal(vtkBoundedPlanePointPlacer::YAxis); }
69  { this->SetProjectionNormal(vtkBoundedPlanePointPlacer::ZAxis); }
71  { this->SetProjectionNormal(vtkBoundedPlanePointPlacer::Oblique); }
73 
75 
79  void SetObliquePlane(vtkPlane *);
80  vtkGetObjectMacro( ObliquePlane, vtkPlane );
82 
84 
91  void SetProjectionPosition(double position);
92  vtkGetMacro(ProjectionPosition, double);
94 
96 
104  void AddBoundingPlane(vtkPlane *plane);
105  void RemoveBoundingPlane(vtkPlane *plane);
106  void RemoveAllBoundingPlanes();
107  virtual void SetBoundingPlanes(vtkPlaneCollection*);
108  vtkGetObjectMacro(BoundingPlanes,vtkPlaneCollection);
109  void SetBoundingPlanes(vtkPlanes *planes);
111 
112  enum
113  {
114  XAxis=0,
117  Oblique
118  };
119 
135  double displayPos[2],
136  double worldPos[3],
137  double worldOrient[9] ) VTK_OVERRIDE;
138 
146  double displayPos[2],
147  double refWorldPos[3],
148  double worldPos[3],
149  double worldOrient[9] ) VTK_OVERRIDE;
150 
156  int ValidateWorldPosition( double worldPos[3] ) VTK_OVERRIDE;
157 
158  // Descrption:
159  // Orientationation is ignored, and the above method
160  // is called instead.
161  int ValidateWorldPosition( double worldPos[3],
162  double worldOrient[9]) VTK_OVERRIDE;
163 
173  double worldPos[3],
174  double worldOrient[9] ) VTK_OVERRIDE;
175 
176 
177 protected:
179  ~vtkBoundedPlanePointPlacer() VTK_OVERRIDE;
180 
181  // Indicates the projection normal as laying along the
182  // XAxis, YAxis, ZAxis, or Oblique. For X, Y, and Z axes,
183  // the projection normal is assumed to be anchored at
184  // (0,0,0)
185  int ProjectionNormal;
186 
187  // Indicates a distance from the origin of the projection
188  // normal where the project plane will be placed
189  double ProjectionPosition;
190 
191  // If the ProjectionNormal is oblique, this is the oblique
192  // plane
193  vtkPlane *ObliquePlane;
194 
195  // A collection of planes used to bound the projection
196  // plane
197  vtkPlaneCollection *BoundingPlanes;
198 
199  // Internal method for getting the project normal as a vector
200  void GetProjectionNormal( double normal[3] );
201 
202  // Internal method for getting the origin of the
203  // constraining plane as a 3-tuple
204  void GetProjectionOrigin( double origin[3] );
205 
206  // Internal method for getting the orientation of
207  // the projection plane
208  void GetCurrentOrientation( double worldOrient[9] );
209 
210  // Calculate the distance of a point from the Object. Negative
211  // values imply that the point is outside. Positive values imply that it is
212  // inside. The closest point to the object is returned in closestPt.
213  static double GetDistanceFromObject( double pos[3],
214  vtkPlaneCollection * pc,
215  double closestPt[3]);
216 
217 private:
218  vtkBoundedPlanePointPlacer(const vtkBoundedPlanePointPlacer&) VTK_DELETE_FUNCTION;
219  void operator=(const vtkBoundedPlanePointPlacer&) VTK_DELETE_FUNCTION;
220 };
221 
222 #endif
virtual int ComputeWorldPosition(vtkRenderer *ren, double displayPos[2], double worldPos[3], double worldOrient[9])
Given a renderer and a display position in pixel coordinates, compute the world position and orientat...
void SetProjectionNormalToXAxis()
Set the projection normal to lie along the x, y, or z axis, or to be oblique.
maintain a list of planes
implicit function for convex set of planes
Definition: vtkPlanes.h:48
abstract specification for renderers
Definition: vtkRenderer.h:57
a placer that constrains a handle to a finite plane
void SetProjectionNormalToZAxis()
Set the projection normal to lie along the x, y, or z axis, or to be oblique.
a simple class to control print indentation
Definition: vtkIndent.h:33
Abstract interface to translate 2D display positions to world coordinates.
perform various plane computations
Definition: vtkPlane.h:31
void SetProjectionNormalToOblique()
Set the projection normal to lie along the x, y, or z axis, or to be oblique.
virtual int UpdateWorldPosition(vtkRenderer *ren, double worldPos[3], double worldOrient[9])
Given a current renderer, world position and orientation, update them according to the constraints of...
virtual int ValidateWorldPosition(double worldPos[3])
Given a world position check the validity of this position according to the constraints of the placer...
static vtkPointPlacer * New()
Instantiate this class.
void SetProjectionNormalToYAxis()
Set the projection normal to lie along the x, y, or z axis, or to be oblique.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.