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 =========================================================================*/
28 #ifndef __vtkBoundedPlanePointPlacer_h
29 #define __vtkBoundedPlanePointPlacer_h
30 
31 #include "vtkPointPlacer.h"
32 
33 class vtkPlane;
34 class vtkPlaneCollection;
35 class vtkPlanes;
36 class vtkRenderer;
37 
38 
40 {
41 public:
44 
46 
48  void PrintSelf(ostream& os, vtkIndent indent);
50 
52 
55  vtkSetClampMacro(ProjectionNormal,int,
58  vtkGetMacro(ProjectionNormal,int);
59  void SetProjectionNormalToXAxis()
60  { this->SetProjectionNormal(vtkBoundedPlanePointPlacer::XAxis); }
61  void SetProjectionNormalToYAxis()
62  { this->SetProjectionNormal(vtkBoundedPlanePointPlacer::YAxis); }
63  void SetProjectionNormalToZAxis()
64  { this->SetProjectionNormal(vtkBoundedPlanePointPlacer::ZAxis); }
65  void SetProjectionNormalToOblique()
66  { this->SetProjectionNormal(vtkBoundedPlanePointPlacer::Oblique); }
68 
70 
72  void SetObliquePlane(vtkPlane *);
73  vtkGetObjectMacro( ObliquePlane, vtkPlane );
75 
77 
81  void SetProjectionPosition(double position);
82  vtkGetMacro(ProjectionPosition, double);
84 
86 
92  void AddBoundingPlane(vtkPlane *plane);
93  void RemoveBoundingPlane(vtkPlane *plane);
94  void RemoveAllBoundingPlanes();
95  virtual void SetBoundingPlanes(vtkPlaneCollection*);
96  vtkGetObjectMacro(BoundingPlanes,vtkPlaneCollection);
97  void SetBoundingPlanes(vtkPlanes *planes);
99 
100 //BTX
101  enum
102  {
103  XAxis=0,
106  Oblique
107  };
108 //ETX
109 
111 
121  double displayPos[2],
122  double worldPos[3],
123  double worldOrient[9] );
125 
127 
130  virtual int ComputeWorldPosition( vtkRenderer *ren,
131  double displayPos[2],
132  double refWorldPos[3],
133  double worldPos[3],
134  double worldOrient[9] );
136 
139  int ValidateWorldPosition( double worldPos[3] );
140 
141  // Descrption:
142  // Orientationation is ignored, and the above method
143  // is called instead.
144  int ValidateWorldPosition( double worldPos[3],
145  double worldOrient[9]);
146 
148 
152  virtual int UpdateWorldPosition( vtkRenderer *ren,
153  double worldPos[3],
154  double worldOrient[9] );
156 
157 
158 protected:
161 
162  // Indicates the projection normal as lying along the
163  // XAxis, YAxis, ZAxis, or Oblique. For X, Y, and Z axes,
164  // the projection normal is assumed to be anchored at
165  // (0,0,0)
167 
168  // Indicates a distance from the origin of the projection
169  // normal where the project plane will be placed
171 
172  // If the ProjectionNormal is oblique, this is the oblique
173  // plane
175 
176  // A collection of planes used to bound the projection
177  // plane
179 
180  // Internal method for getting the project normal as a vector
181  void GetProjectionNormal( double normal[3] );
182 
183  // Internal method for getting the origin of the
184  // constraining plane as a 3-tuple
185  void GetProjectionOrigin( double origin[3] );
186 
187  // Internal method for getting the orientation of
188  // the projection plane
189  void GetCurrentOrientation( double worldOrient[9] );
190 
191  // Calculate the distance of a point from the Object. Negative
192  // values imply that the point is outside. Positive values imply that it is
193  // inside. The closest point to the object is returned in closestPt.
194  static double GetDistanceFromObject( double pos[3],
195  vtkPlaneCollection * pc,
196  double closestPt[3]);
197 
198 private:
199  vtkBoundedPlanePointPlacer(const vtkBoundedPlanePointPlacer&); //Not implemented
200  void operator=(const vtkBoundedPlanePointPlacer&); //Not implemented
201 };
202 
203 #endif