VTK  9.0.1
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 class VTKINTERACTIONWIDGETS_EXPORT vtkBoundedPlanePointPlacer : public vtkPointPlacer
38 {
39 public:
44 
46 
50  void PrintSelf(ostream& os, vtkIndent indent) override;
52 
54 
59  vtkSetClampMacro(
61  vtkGetMacro(ProjectionNormal, int);
63  {
64  this->SetProjectionNormal(vtkBoundedPlanePointPlacer::XAxis);
65  }
67  {
68  this->SetProjectionNormal(vtkBoundedPlanePointPlacer::YAxis);
69  }
71  {
72  this->SetProjectionNormal(vtkBoundedPlanePointPlacer::ZAxis);
73  }
75  {
76  this->SetProjectionNormal(vtkBoundedPlanePointPlacer::Oblique);
77  }
79 
81 
86  vtkGetObjectMacro(ObliquePlane, vtkPlane);
88 
90 
98  vtkGetMacro(ProjectionPosition, double);
100 
102 
114  vtkGetObjectMacro(BoundingPlanes, vtkPlaneCollection);
117 
118  enum
119  {
120  XAxis = 0,
123  Oblique
124  };
125 
141  vtkRenderer* ren, double displayPos[2], double worldPos[3], double worldOrient[9]) override;
142 
149  int ComputeWorldPosition(vtkRenderer* ren, double displayPos[2], double refWorldPos[3],
150  double worldPos[3], double worldOrient[9]) override;
151 
157  int ValidateWorldPosition(double worldPos[3]) override;
158 
159  // Descrption:
160  // Orientationation is ignored, and the above method
161  // is called instead.
162  int ValidateWorldPosition(double worldPos[3], double worldOrient[9]) override;
163 
172  int UpdateWorldPosition(vtkRenderer* ren, double worldPos[3], double worldOrient[9]) override;
173 
174 protected:
177 
178  // Indicates the projection normal as laying along the
179  // XAxis, YAxis, ZAxis, or Oblique. For X, Y, and Z axes,
180  // the projection normal is assumed to be anchored at
181  // (0,0,0)
183 
184  // Indicates a distance from the origin of the projection
185  // normal where the project plane will be placed
187 
188  // If the ProjectionNormal is oblique, this is the oblique
189  // plane
191 
192  // A collection of planes used to bound the projection
193  // plane
195 
196  // Internal method for getting the project normal as a vector
197  void GetProjectionNormal(double normal[3]);
198 
199  // Internal method for getting the origin of the
200  // constraining plane as a 3-tuple
201  void GetProjectionOrigin(double origin[3]);
202 
203  // Internal method for getting the orientation of
204  // the projection plane
205  void GetCurrentOrientation(double worldOrient[9]);
206 
207  // Calculate the distance of a point from the Object. Negative
208  // values imply that the point is outside. Positive values imply that it is
209  // inside. The closest point to the object is returned in closestPt.
210  static double GetDistanceFromObject(double pos[3], vtkPlaneCollection* pc, double closestPt[3]);
211 
212 private:
214  void operator=(const vtkBoundedPlanePointPlacer&) = delete;
215 };
216 
217 #endif
a placer that constrains a handle to a finite plane
static vtkBoundedPlanePointPlacer * New()
Instantiate this class.
void SetProjectionPosition(double position)
The position of the bounding plane from the origin along the normal.
void GetProjectionOrigin(double origin[3])
void SetBoundingPlanes(vtkPlanes *planes)
void SetObliquePlane(vtkPlane *)
If the ProjectionNormal is set to Oblique, then this is the oblique plane used to constrain the handl...
int ComputeWorldPosition(vtkRenderer *ren, double displayPos[2], double worldPos[3], double worldOrient[9]) override
Given a renderer and a display position, compute the world position and world orientation for this po...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void SetBoundingPlanes(vtkPlaneCollection *)
void GetCurrentOrientation(double worldOrient[9])
void RemoveBoundingPlane(vtkPlane *plane)
void GetProjectionNormal(double normal[3])
static double GetDistanceFromObject(double pos[3], vtkPlaneCollection *pc, double closestPt[3])
int UpdateWorldPosition(vtkRenderer *ren, double worldPos[3], double worldOrient[9]) override
If the constraints on this placer are changed, then this method will be called by the representation ...
void AddBoundingPlane(vtkPlane *plane)
A collection of plane equations used to bound the position of the point.
int ValidateWorldPosition(double worldPos[3], double worldOrient[9]) override
Given a world position and a world orientation, validate it according to the constraints of the place...
~vtkBoundedPlanePointPlacer() override
int ValidateWorldPosition(double worldPos[3]) override
Give a world position check if it is valid - does it lie on the plane and within the bounds?...
int ComputeWorldPosition(vtkRenderer *ren, double displayPos[2], double refWorldPos[3], double worldPos[3], double worldOrient[9]) override
Given a renderer, a display position, and a reference world position, compute the new world position ...
a simple class to control print indentation
Definition: vtkIndent.h:34
maintain a list of planes
perform various plane computations
Definition: vtkPlane.h:32
implicit function for convex set of planes
Definition: vtkPlanes.h:50
Abstract interface to translate 2D display positions to world coordinates.
abstract specification for renderers
Definition: vtkRenderer.h:59
@ position
Definition: vtkX3D.h:267