VTK  9.1.0
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
32class vtkPlane;
34class vtkPlanes;
35class vtkRenderer;
36
37class VTKINTERACTIONWIDGETS_EXPORT vtkBoundedPlanePointPlacer : public vtkPointPlacer
38{
39public:
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
97 void SetProjectionPosition(double position);
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
174protected:
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
212private:
214 void operator=(const vtkBoundedPlanePointPlacer&) = delete;
215};
216
217#endif
a placer that constrains a handle to a finite plane
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])
static vtkBoundedPlanePointPlacer * New()
Instantiate this class.
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:113
maintain a list of planes
perform various plane computations
Definition: vtkPlane.h:143
implicit function for convex set of planes
Definition: vtkPlanes.h:159
Abstract interface to translate 2D display positions to world coordinates.
abstract specification for renderers
Definition: vtkRenderer.h:182