-
Notifications
You must be signed in to change notification settings - Fork 13
/
H3NonadaptivePicker.java
91 lines (75 loc) · 2.6 KB
/
H3NonadaptivePicker.java
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
//
// The Walrus Graph Visualization Tool.
// Copyright (C) 2000,2001,2002 The Regents of the University of California.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// ######END_HEADER######
//
import javax.media.j3d.*;
import javax.vecmath.*;
public class H3NonadaptivePicker
extends H3PickerCommon
{
////////////////////////////////////////////////////////////////////////
// CONSTRUCTORS
////////////////////////////////////////////////////////////////////////
public H3NonadaptivePicker(H3Graph graph, H3Canvas3D canvas,
H3ViewParameters parameters)
{
super(graph, canvas, parameters);
m_numNodes = graph.getNumNodes();
}
////////////////////////////////////////////////////////////////////////
// INTERFACE METHODS (H3Picker)
////////////////////////////////////////////////////////////////////////
public void reset()
{
m_computedPointsInEye = false;
}
////////////////////////////////////////////////////////////////////////
// PROTECTED METHODS (abstract in H3PickerCommon)
////////////////////////////////////////////////////////////////////////
protected void computePointsInEye()
{
if (!m_computedPointsInEye)
{
m_computedPointsInEye = true;
Transform3D transform = m_parameters.getObjectToEyeTransform();
Point3d p = new Point3d();
for (int i = 0; i < m_numNodes; i++)
{
m_graph.getNodeCoordinates(i, p);
transform.transform(p);
m_pointsInEyeX[i] = p.x;
m_pointsInEyeY[i] = p.y;
m_pointsInEyeZ[i] = p.z;
}
}
}
protected int getNumComputedPointsInEye()
{
return m_numNodes;
}
protected int getNodeInEye(int index)
{
return index;
}
////////////////////////////////////////////////////////////////////////
// PRIVATE FIELDS
////////////////////////////////////////////////////////////////////////
private int m_numNodes;
private boolean m_computedPointsInEye = false;
}