VTK  9.3.20240329
vtkBoundedPlanePointPlacer.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
17 #ifndef vtkBoundedPlanePointPlacer_h
18 #define vtkBoundedPlanePointPlacer_h
19 
20 #include "vtkInteractionWidgetsModule.h" // For export macro
21 #include "vtkPointPlacer.h"
22 
23 VTK_ABI_NAMESPACE_BEGIN
24 class vtkPlane;
25 class vtkPlaneCollection;
26 class vtkPlanes;
27 class vtkRenderer;
28 
29 class VTKINTERACTIONWIDGETS_EXPORT vtkBoundedPlanePointPlacer : public vtkPointPlacer
30 {
31 public:
36 
38 
42  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
46 
51  vtkSetClampMacro(
53  vtkGetMacro(ProjectionNormal, int);
55  {
56  this->SetProjectionNormal(vtkBoundedPlanePointPlacer::XAxis);
57  }
59  {
60  this->SetProjectionNormal(vtkBoundedPlanePointPlacer::YAxis);
61  }
63  {
64  this->SetProjectionNormal(vtkBoundedPlanePointPlacer::ZAxis);
65  }
67  {
68  this->SetProjectionNormal(vtkBoundedPlanePointPlacer::Oblique);
69  }
71 
73 
78  vtkGetObjectMacro(ObliquePlane, vtkPlane);
80 
82 
90  vtkGetMacro(ProjectionPosition, double);
92 
94 
106  vtkGetObjectMacro(BoundingPlanes, vtkPlaneCollection);
109 
110  enum
111  {
112  XAxis = 0,
115  Oblique
116  };
117 
133  vtkRenderer* ren, double displayPos[2], double worldPos[3], double worldOrient[9]) override;
134 
141  int ComputeWorldPosition(vtkRenderer* ren, double displayPos[2], double refWorldPos[3],
142  double worldPos[3], double worldOrient[9]) override;
143 
149  int ValidateWorldPosition(double worldPos[3]) override;
150 
151  // Description:
152  // Orientationation is ignored, and the above method
153  // is called instead.
154  int ValidateWorldPosition(double worldPos[3], double worldOrient[9]) override;
155 
164  int UpdateWorldPosition(vtkRenderer* ren, double worldPos[3], double worldOrient[9]) override;
165 
166 protected:
169 
170  // Indicates the projection normal as laying along the
171  // XAxis, YAxis, ZAxis, or Oblique. For X, Y, and Z axes,
172  // the projection normal is assumed to be anchored at
173  // (0,0,0)
175 
176  // Indicates a distance from the origin of the projection
177  // normal where the project plane will be placed
179 
180  // If the ProjectionNormal is oblique, this is the oblique
181  // plane
183 
184  // A collection of planes used to bound the projection
185  // plane
187 
188  // Internal method for getting the project normal as a vector
189  void GetProjectionNormal(double normal[3]);
190 
191  // Internal method for getting the origin of the
192  // constraining plane as a 3-tuple
193  void GetProjectionOrigin(double origin[3]);
194 
195  // Internal method for getting the orientation of
196  // the projection plane
197  void GetCurrentOrientation(double worldOrient[9]);
198 
199  // Calculate the distance of a point from the Object. Negative
200  // values imply that the point is outside. Positive values imply that it is
201  // inside. The closest point to the object is returned in closestPt.
202  static double GetDistanceFromObject(double pos[3], vtkPlaneCollection* pc, double closestPt[3]);
203 
204 private:
206  void operator=(const vtkBoundedPlanePointPlacer&) = delete;
207 };
208 
209 VTK_ABI_NAMESPACE_END
210 #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)
A collection of plane equations used to bound the position of the point.
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
Standard methods for instances of this class.
virtual void SetBoundingPlanes(vtkPlaneCollection *)
A collection of plane equations used to bound the position of the point.
void SetProjectionNormalToYAxis()
Set the projection normal to lie along the x, y, or z axis, or to be oblique.
void GetCurrentOrientation(double worldOrient[9])
void SetProjectionNormalToZAxis()
Set the projection normal to lie along the x, y, or z axis, or to be oblique.
void RemoveBoundingPlane(vtkPlane *plane)
A collection of plane equations used to bound the position of the point.
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.
void SetProjectionNormalToXAxis()
Set the projection normal to lie along the x, y, or z axis, or to be oblique.
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...
void SetProjectionNormalToOblique()
Set the projection normal to lie along the x, y, or z axis, or to be oblique.
~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 ...
void RemoveAllBoundingPlanes()
A collection of plane equations used to bound the position of the point.
a simple class to control print indentation
Definition: vtkIndent.h:108
maintain a list of planes
perform various plane computations
Definition: vtkPlane.h:135
implicit function for convex set of planes
Definition: vtkPlanes.h:151
Abstract interface to translate 2D display positions to world coordinates.
abstract specification for renderers
Definition: vtkRenderer.h:172
@ position
Definition: vtkX3D.h:261