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) 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] ) override;
138 
146  double displayPos[2],
147  double refWorldPos[3],
148  double worldPos[3],
149  double worldOrient[9] ) override;
150 
156  int ValidateWorldPosition( double worldPos[3] ) 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]) override;
163 
173  double worldPos[3],
174  double worldOrient[9] ) override;
175 
176 
177 protected:
179  ~vtkBoundedPlanePointPlacer() 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)
186 
187  // Indicates a distance from the origin of the projection
188  // normal where the project plane will be placed
190 
191  // If the ProjectionNormal is oblique, this is the oblique
192  // plane
194 
195  // A collection of planes used to bound the projection
196  // plane
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:
219  void operator=(const vtkBoundedPlanePointPlacer&) = delete;
220 };
221 
222 #endif
vtkPlane
perform various plane computations
Definition: vtkPlane.h:31
vtkBoundedPlanePointPlacer
a placer that constrains a handle to a finite plane
Definition: vtkBoundedPlanePointPlacer.h:38
vtkBoundedPlanePointPlacer::XAxis
Definition: vtkBoundedPlanePointPlacer.h:114
vtkBoundedPlanePointPlacer::ProjectionPosition
double ProjectionPosition
Definition: vtkBoundedPlanePointPlacer.h:189
vtkBoundedPlanePointPlacer::BoundingPlanes
vtkPlaneCollection * BoundingPlanes
Definition: vtkBoundedPlanePointPlacer.h:197
vtkPointPlacer
Abstract interface to translate 2D display positions to world coordinates.
Definition: vtkPointPlacer.h:49
vtkBoundedPlanePointPlacer::SetProjectionNormalToOblique
void SetProjectionNormalToOblique()
Definition: vtkBoundedPlanePointPlacer.h:70
vtkPlanes
implicit function for convex set of planes
Definition: vtkPlanes.h:49
vtkPointPlacer::New
static vtkPointPlacer * New()
Instantiate this class.
vtkX3D::position
Definition: vtkX3D.h:261
vtkBoundedPlanePointPlacer::ObliquePlane
vtkPlane * ObliquePlane
Definition: vtkBoundedPlanePointPlacer.h:193
vtkBoundedPlanePointPlacer::ZAxis
Definition: vtkBoundedPlanePointPlacer.h:116
vtkBoundedPlanePointPlacer::YAxis
Definition: vtkBoundedPlanePointPlacer.h:115
vtkBoundedPlanePointPlacer::SetProjectionNormalToXAxis
void SetProjectionNormalToXAxis()
Definition: vtkBoundedPlanePointPlacer.h:64
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkBoundedPlanePointPlacer::ProjectionNormal
int ProjectionNormal
Definition: vtkBoundedPlanePointPlacer.h:185
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:57
vtkBoundedPlanePointPlacer::SetProjectionNormalToZAxis
void SetProjectionNormalToZAxis()
Definition: vtkBoundedPlanePointPlacer.h:68
vtkPointPlacer::ComputeWorldPosition
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...
vtkBoundedPlanePointPlacer::SetProjectionNormalToYAxis
void SetProjectionNormalToYAxis()
Definition: vtkBoundedPlanePointPlacer.h:66
vtkPlaneCollection
maintain a list of planes
Definition: vtkPlaneCollection.h:33
vtkPointPlacer.h
vtkBoundedPlanePointPlacer::Oblique
Definition: vtkBoundedPlanePointPlacer.h:117
vtkPointPlacer::ValidateWorldPosition
virtual int ValidateWorldPosition(double worldPos[3])
Given a world position check the validity of this position according to the constraints of the placer...
vtkPointPlacer::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPointPlacer::UpdateWorldPosition
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...