VTK  9.2.6
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 class VTKINTERACTIONWIDGETS_EXPORT vtkBoundedPlanePointPlacer : public vtkPointPlacer
41 {
42 public:
47 
49 
53  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
57 
62  vtkSetClampMacro(
64  vtkGetMacro(ProjectionNormal, int);
66  {
67  this->SetProjectionNormal(vtkBoundedPlanePointPlacer::XAxis);
68  }
70  {
71  this->SetProjectionNormal(vtkBoundedPlanePointPlacer::YAxis);
72  }
74  {
75  this->SetProjectionNormal(vtkBoundedPlanePointPlacer::ZAxis);
76  }
78  {
79  this->SetProjectionNormal(vtkBoundedPlanePointPlacer::Oblique);
80  }
82 
84 
88  void SetObliquePlane(vtkPlane*);
89  vtkGetObjectMacro(ObliquePlane, vtkPlane);
91 
93 
100  void SetProjectionPosition(double position);
101  vtkGetMacro(ProjectionPosition, double);
103 
105 
113  void AddBoundingPlane(vtkPlane* plane);
114  void RemoveBoundingPlane(vtkPlane* plane);
115  void RemoveAllBoundingPlanes();
116  virtual void SetBoundingPlanes(vtkPlaneCollection*);
117  vtkGetObjectMacro(BoundingPlanes, vtkPlaneCollection);
118  void SetBoundingPlanes(vtkPlanes* planes);
120 
121  enum
122  {
123  XAxis = 0,
126  Oblique
127  };
128 
144  vtkRenderer* ren, double displayPos[2], double worldPos[3], double worldOrient[9]) override;
145 
152  int ComputeWorldPosition(vtkRenderer* ren, double displayPos[2], double refWorldPos[3],
153  double worldPos[3], double worldOrient[9]) override;
154 
160  int ValidateWorldPosition(double worldPos[3]) override;
161 
162  // Descrption:
163  // Orientationation is ignored, and the above method
164  // is called instead.
165  int ValidateWorldPosition(double worldPos[3], double worldOrient[9]) override;
166 
175  int UpdateWorldPosition(vtkRenderer* ren, double worldPos[3], double worldOrient[9]) override;
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], vtkPlaneCollection* pc, double closestPt[3]);
214 
215 private:
217  void operator=(const vtkBoundedPlanePointPlacer&) = delete;
218 };
219 
220 #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:52
abstract specification for renderers
Definition: vtkRenderer.h:72
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:36
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.