forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vtkPointPlacer.cxx
106 lines (89 loc) · 3.53 KB
/
vtkPointPlacer.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*=========================================================================
Program: Visualization Toolkit
Module: vtkPointPlacer.cxx,v
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkPointPlacer.h"
#include "vtkObjectFactory.h"
#include "vtkRenderer.h"
#include "vtkCoordinate.h"
vtkStandardNewMacro(vtkPointPlacer);
//----------------------------------------------------------------------
vtkPointPlacer::vtkPointPlacer()
{
this->PixelTolerance = 5;
this->WorldTolerance = 0.001;
}
//----------------------------------------------------------------------
vtkPointPlacer::~vtkPointPlacer() = default;
//----------------------------------------------------------------------
int vtkPointPlacer::UpdateWorldPosition( vtkRenderer *vtkNotUsed(ren),
double *vtkNotUsed(worldPos),
double *vtkNotUsed(worldOrient) )
{
return 1;
}
//----------------------------------------------------------------------
int vtkPointPlacer::ComputeWorldPosition( vtkRenderer *ren,
double displayPos[2],
double worldPos[3],
double vtkNotUsed(worldOrient)[9] )
{
if (ren)
{
vtkCoordinate *dpos = vtkCoordinate::New();
dpos->SetCoordinateSystemToDisplay();
dpos->SetValue( displayPos[0], displayPos[1] );
double * p = dpos->GetComputedWorldValue( ren );
worldPos[0] = p[0];
worldPos[1] = p[1];
worldPos[2] = p[2];
dpos->Delete();
return 1;
}
return 0;
}
//----------------------------------------------------------------------
int vtkPointPlacer::ComputeWorldPosition( vtkRenderer * ren,
double displayPos[2],
double vtkNotUsed(refWorldPos)[3],
double worldPos[3],
double worldOrient[9] )
{
return this->ComputeWorldPosition( ren, displayPos, worldPos, worldOrient );
}
//----------------------------------------------------------------------
int vtkPointPlacer::ValidateWorldPosition( double vtkNotUsed(worldPos)[3] )
{
return 1;
}
//----------------------------------------------------------------------
int vtkPointPlacer::ValidateWorldPosition( double vtkNotUsed(worldPos)[3],
double vtkNotUsed(worldOrient)[9] )
{
return 1;
}
//----------------------------------------------------------------------
int vtkPointPlacer::ValidateDisplayPosition( vtkRenderer *,
double vtkNotUsed(displayPos)[2] )
{
return 1;
}
//----------------------------------------------------------------------
void vtkPointPlacer::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
os << indent << "Pixel Tolerance: " << this->PixelTolerance << "\n";
os << indent << "World Tolerance: " << this->WorldTolerance << "\n";
}
//----------------------------------------------------------------------
int vtkPointPlacer::
UpdateNodeWorldPosition(double vtkNotUsed(worldPos)[3], vtkIdType vtkNotUsed(nodePointId))
{
return 1;
}