-
Notifications
You must be signed in to change notification settings - Fork 3
/
HMesh3D.java
137 lines (121 loc) · 2.99 KB
/
HMesh3D.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package hgeom.hmesh.elements;
import hgeom.hmesh.data.HDData;
/**
* A half-edge data structure in the 3D space. Each vertex of the structure has
* 3D coordinates
*
* @author Pierre B.
*/
public interface HMesh3D extends HMesh {
/**
* Gets the {@link HDData} containing the x coordinates of the vertices of
* this mesh
*
* @return
*/
HDData<HVertex> vertexXs();
/**
* Gets the {@link HDData} containing the y coordinates of the vertices of
* this mesh
*
* @return
*/
HDData<HVertex> vertexYs();
/**
* Gets the {@link HDData} containing the z coordinates of the vertices of
* this mesh
*
* @return
*/
HDData<HVertex> vertexZs();
/**
* Gets the x coordinate of the given vertex
*
* @param v
* @return the x coordinate
*/
double vertexX(HVertex v);
/**
* Sets the x coordinate of the given vertex
*
* @param v
* @param x the x coordinate to be set
*/
void setVertexX(HVertex v, double x);
/**
* Gets the y coordinate of the given vertex
*
* @param v
* @return the y coordinate
*/
double vertexY(HVertex v);
/**
* Sets the y coordinate of the given vertex
*
* @param v
* @param y the y coordinate to be set
*/
void setVertexY(HVertex v, double y);
/**
* Gets the z coordinate of the given vertex
*
* @param v
* @return the y coordinate
*/
double vertexZ(HVertex v);
/**
* Sets the z coordinate of the given vertex
*
* @param v
* @param y the y coordinate to be set
*/
void setVertexZ(HVertex v, double y);
/**
* Gets the coordinates of the given vertex
*
* @param v
* @return an array [x y z] containing the coordinates
*/
default double[] vertexXYZ(HVertex v) {
return vertexXYZ(v, null);
}
/**
* Gets the coordinates of the given vertex
*
* @param v
* @param xyz if not {@code null}, will contain the coordinates
* @return an array [x y z] containing the coordinates
*/
double[] vertexXYZ(HVertex v, double[] xyz);
/**
* Sets the coordinate of the given vertex
*
* @param v
* @param xyz the coordinates to be set
*/
void setVertexXYZ(HVertex v, double[] xyz);
/**
* Sets the coordinate of the given vertex
*
* @param v
* @param x the x coordinate to be set
* @param y the y coordinate to be set
* @param z the y coordinate to be set
*/
void setVertexXYZ(HVertex v, double x, double y, double z);
/**
* Calls {@link HMesh#splitEdge(HEdge)} to split the specified half-edge;
* then sets the specified coordinates to the vertex created by the split
*
* @param edge
* @param x a x coordinate for the new vertex
* @param y a y coordinate for the new vertex
* @param z a z coordinate for the new vertex
* @return the new vertex created by the split. Never {@code null}.
*/
default HVertex splitEdge(HEdge edge, double x, double y, double z) {
HVertex v = splitEdge(edge);
setVertexXYZ(v, x, y, z);
return v;
}
}