1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkFocalPlanePointPlacer.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 =========================================================================*/ 15 // .SECTION Description 16 // 17 // 18 // .SECTION See Also 19 20 #ifndef vtkFocalPlanePointPlacer_h 21 #define vtkFocalPlanePointPlacer_h 22 23 #include "vtkInteractionWidgetsModule.h" // For export macro 24 #include "vtkPointPlacer.h" 25 26 class vtkRenderer; 27 28 class VTKINTERACTIONWIDGETS_EXPORT vtkFocalPlanePointPlacer : public vtkPointPlacer 29 { 30 public: 31 /** 32 * Instantiate this class. 33 */ 34 static vtkFocalPlanePointPlacer* New(); 35 36 ///@{ 37 /** 38 * Standard methods for instances of this class. 39 */ 40 vtkTypeMacro(vtkFocalPlanePointPlacer, vtkPointPlacer); 41 void PrintSelf(ostream& os, vtkIndent indent) override; 42 ///@} 43 44 // Description: 45 // Given a renderer and a display position, compute 46 // the world position and orientation. The orientation 47 // computed by the placer will always line up with the 48 // standard coordinate axes. The world position will be 49 // computed by projecting the display position onto the 50 // focal plane. This method is typically used to place a 51 // point for the first time. 52 int ComputeWorldPosition( 53 vtkRenderer* ren, double displayPos[2], double worldPos[3], double worldOrient[9]) override; 54 55 /** 56 * Given a renderer, a display position, and a reference 57 * world position, compute a new world position. The 58 * orientation will be the standard coordinate axes, and the 59 * computed world position will be created by projecting 60 * the display point onto a plane that is parallel to 61 * the focal plane and runs through the reference world 62 * position. This method is typically used to move existing 63 * points. 64 */ 65 int ComputeWorldPosition(vtkRenderer* ren, double displayPos[2], double refWorldPos[3], 66 double worldPos[3], double worldOrient[9]) override; 67 68 ///@{ 69 /** 70 * Validate a world position. All world positions 71 * are valid so these methods always return 1. 72 */ 73 int ValidateWorldPosition(double worldPos[3]) override; 74 int ValidateWorldPosition(double worldPos[3], double worldOrient[9]) override; 75 ///@} 76 77 ///@{ 78 /** 79 * Optionally specify a signed offset from the focal plane for the points to 80 * be placed at. If negative, the constraint plane is offset closer to the 81 * camera. If positive, its further away from the camera. 82 */ 83 vtkSetMacro(Offset, double); 84 vtkGetMacro(Offset, double); 85 ///@} 86 87 ///@{ 88 /** 89 * Optionally Restrict the points to a set of bounds. The placer will 90 * invalidate points outside these bounds. 91 */ 92 vtkSetVector6Macro(PointBounds, double); 93 vtkGetVector6Macro(PointBounds, double); 94 ///@} 95 96 protected: 97 vtkFocalPlanePointPlacer(); 98 ~vtkFocalPlanePointPlacer() override; 99 100 void GetCurrentOrientation(double worldOrient[9]); 101 102 double PointBounds[6]; 103 double Offset; 104 105 private: 106 vtkFocalPlanePointPlacer(const vtkFocalPlanePointPlacer&) = delete; 107 void operator=(const vtkFocalPlanePointPlacer&) = delete; 108 }; 109 110 #endif 111