1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkSelectVisiblePoints.h,v $
6 Date: $Date: 2002/08/22 22:00:34 $
7 Version: $Revision: 1.23 $
9 Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
11 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notice for more information.
17 =========================================================================*/
18 // .NAME vtkSelectVisiblePoints - extract points that are visible (based on z-buffer calculation)
19 // .SECTION Description
20 // vtkSelectVisiblePoints is a filter that selects points based on
21 // whether they are visible or not. Visibility is determined by
22 // accessing the z-buffer of a rendering window. (The position of each
23 // input point is converted into display coordinates, and then the
24 // z-value at that point is obtained. If within the user-specified
25 // tolerance, the point is considered visible.)
27 // Points that are visible (or if the ivar SelectInvisible is on,
28 // invisible points) are passed to the output. Associated data
29 // attributes are passed to the output as well.
31 // This filter also allows you to specify a rectangular window in display
32 // (pixel) coordinates in which the visible points must lie. This can be
33 // used as a sort of local "brushing" operation to select just data within
38 // You must carefully synchronize the execution of this filter. The
39 // filter refers to a renderer, which is modified every time a render
40 // occurs. Therefore, the filter is always out of date, and always
41 // executes. You may have to perform two rendering passes, or if you
42 // are using this filter in conjunction with vtkLabeledPointMapper,
43 // things work out because 2D rendering occurs after the 3D rendering.
45 #ifndef __vtkSelectVisiblePoints_h
46 #define __vtkSelectVisiblePoints_h
48 #include "vtkDataSetToPolyDataFilter.h"
52 class VTK_RENDERING_EXPORT vtkSelectVisiblePoints : public vtkDataSetToPolyDataFilter
55 vtkTypeRevisionMacro(vtkSelectVisiblePoints,vtkDataSetToPolyDataFilter);
56 void PrintSelf(ostream& os, vtkIndent indent);
59 // Instantiate object with no renderer; window selection turned off;
60 // tolerance set to 0.01; and select invisible off.
61 static vtkSelectVisiblePoints *New();
64 // Specify the renderer in which the visibility computation is to be
66 void SetRenderer(vtkRenderer* ren)
68 if (this->Renderer != ren)
74 vtkRenderer* GetRenderer() { return this->Renderer; }
77 // Set/Get the flag which enables selection in a rectangular display
79 vtkSetMacro(SelectionWindow,int);
80 vtkGetMacro(SelectionWindow,int);
81 vtkBooleanMacro(SelectionWindow,int);
84 // Specify the selection window in display coordinates. You must specify
85 // a rectangular region using (xmin,xmax,ymin,ymax).
86 vtkSetVector4Macro(Selection,int);
87 vtkGetVectorMacro(Selection,int,4);
90 // Set/Get the flag which enables inverse selection; i.e., invisible points
92 vtkSetMacro(SelectInvisible,int);
93 vtkGetMacro(SelectInvisible,int);
94 vtkBooleanMacro(SelectInvisible,int);
97 // Set/Get a tolerance to use to determine whether a point is visible. A
98 // tolerance is usually required because the conversion from world space
99 // to display space during rendering introduces numerical round-off.
100 vtkSetClampMacro(Tolerance,float,0.0,VTK_LARGE_FLOAT);
101 vtkGetMacro(Tolerance,float);
104 // Return MTime also considering the renderer.
105 unsigned long GetMTime();
108 vtkSelectVisiblePoints();
109 ~vtkSelectVisiblePoints();
113 vtkRenderer *Renderer;
121 vtkSelectVisiblePoints(const vtkSelectVisiblePoints&); // Not implemented.
122 void operator=(const vtkSelectVisiblePoints&); // Not implemented.