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 =========================================================================*/
29 #ifndef vtkBoundedPlanePointPlacer_h
30 #define vtkBoundedPlanePointPlacer_h
31 
32 #include "vtkInteractionWidgetsModule.h" // For export macro
33 #include "vtkPointPlacer.h"
34 
35 class vtkPlane;
36 class vtkPlaneCollection;
37 class vtkPlanes;
38 class vtkRenderer;
39 
40 
41 class VTKINTERACTIONWIDGETS_EXPORT vtkBoundedPlanePointPlacer : public vtkPointPlacer
42 {
43 public:
48 
50 
54  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
58 
63  vtkSetClampMacro(ProjectionNormal,int,
66  vtkGetMacro(ProjectionNormal,int);
68  { this->SetProjectionNormal(vtkBoundedPlanePointPlacer::XAxis); }
70  { this->SetProjectionNormal(vtkBoundedPlanePointPlacer::YAxis); }
72  { this->SetProjectionNormal(vtkBoundedPlanePointPlacer::ZAxis); }
74  { this->SetProjectionNormal(vtkBoundedPlanePointPlacer::Oblique); }
76 
78 
82  void SetObliquePlane(vtkPlane *);
83  vtkGetObjectMacro( ObliquePlane, vtkPlane );
85 
87 
94  void SetProjectionPosition(double position);
95  vtkGetMacro(ProjectionPosition, double);
97 
99 
107  void AddBoundingPlane(vtkPlane *plane);
108  void RemoveBoundingPlane(vtkPlane *plane);
109  void RemoveAllBoundingPlanes();
110  virtual void SetBoundingPlanes(vtkPlaneCollection*);
111  vtkGetObjectMacro(BoundingPlanes,vtkPlaneCollection);
112  void SetBoundingPlanes(vtkPlanes *planes);
114 
115  enum
116  {
117  XAxis=0,
120  Oblique
121  };
122 
138  double displayPos[2],
139  double worldPos[3],
140  double worldOrient[9] ) override;
141 
149  double displayPos[2],
150  double refWorldPos[3],
151  double worldPos[3],
152  double worldOrient[9] ) override;
153 
159  int ValidateWorldPosition( double worldPos[3] ) override;
160 
161  // Descrption:
162  // Orientationation is ignored, and the above method
163  // is called instead.
164  int ValidateWorldPosition( double worldPos[3],
165  double worldOrient[9]) override;
166 
176  double worldPos[3],
177  double worldOrient[9] ) override;
178 
179 
180 protected:
182  ~vtkBoundedPlanePointPlacer() override;
183 
184  // Indicates the projection normal as laying along the
185  // XAxis, YAxis, ZAxis, or Oblique. For X, Y, and Z axes,
186  // the projection normal is assumed to be anchored at
187  // (0,0,0)
189 
190  // Indicates a distance from the origin of the projection
191  // normal where the project plane will be placed
193 
194  // If the ProjectionNormal is oblique, this is the oblique
195  // plane
197 
198  // A collection of planes used to bound the projection
199  // plane
201 
202  // Internal method for getting the project normal as a vector
203  void GetProjectionNormal( double normal[3] );
204 
205  // Internal method for getting the origin of the
206  // constraining plane as a 3-tuple
207  void GetProjectionOrigin( double origin[3] );
208 
209  // Internal method for getting the orientation of
210  // the projection plane
211  void GetCurrentOrientation( double worldOrient[9] );
212 
213  // Calculate the distance of a point from the Object. Negative
214  // values imply that the point is outside. Positive values imply that it is
215  // inside. The closest point to the object is returned in closestPt.
216  static double GetDistanceFromObject( double pos[3],
217  vtkPlaneCollection * pc,
218  double closestPt[3]);
219 
220 private:
222  void operator=(const vtkBoundedPlanePointPlacer&) = delete;
223 };
224 
225 #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:55
abstract specification for renderers
Definition: vtkRenderer.h:63
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:39
Abstract interface to translate 2D display positions to world coordinates.
perform various plane computations
Definition: vtkPlane.h:37
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.