E
- the edge class of this half-edge data structureF
- the face class of this half-edge data structureV
- the vertex class of this half-edge data structurepublic class HalfEdgeDataStructure<V extends Vertex<V,E,F>,E extends Edge<V,E,F>,F extends Face<V,E,F>> extends Object
Constructor and Description |
---|
HalfEdgeDataStructure(Class<V> vClass,
Class<E> eClass,
Class<F> fClass)
Instantiate a new half-edge data structure with given
vertex, edge, and face classes.
|
Modifier and Type | Method and Description |
---|---|
E |
addNewEdge()
Add a new edge to this half-edge data structure.
|
List<E> |
addNewEdges(int n)
Add
n new edges to this half-edge data structure. |
F |
addNewFace()
Add a new face to this half-edge data structure.
|
List<F> |
addNewFaces(int n)
Add
n new faces to this half-edge data structure. |
V |
addNewVertex()
Add a new vertex to this half-edge data structure.
|
List<V> |
addNewVertices(int n)
Add
n new vertices to this half-edge data structure. |
void |
clear() |
<VV extends Vertex<VV,EE,FF>,EE extends Edge<VV,EE,FF>,FF extends Face<VV,EE,FF>> |
createCombinatoriallyEquivalentCopy(Class<VV> vC,
Class<EE> eC,
Class<FF> fC)
Create a combinatorially equivalent copy of this half-edge data structure.
|
<VV extends Vertex<VV,EE,FF>,EE extends Edge<VV,EE,FF>,FF extends Face<VV,EE,FF>,HEDS extends HalfEdgeDataStructure<VV,EE,FF>> |
createCombinatoriallyEquivalentCopy(HEDS heds)
Create a combinatorially equivalent copy of this half-edge data structure.
|
E |
getEdge(int index)
Return edge with given index from edge list.
|
Class<E> |
getEdgeClass()
Return edge class of this half-edge data structure.
|
List<E> |
getEdges()
Return the edge list.
|
F |
getFace(int index)
Return face with given index from face list.
|
Class<F> |
getFaceClass()
Return face class of this half-edge data structure.
|
List<F> |
getFaces()
Return the face list.
|
Iterable<E> |
getNegativeEdges()
Return an
Iterable for iterating over the positive edges. |
Iterable<E> |
getPositiveEdges()
Return an
Iterable for iterating over the positive edges. |
V |
getVertex(int index)
Return vertex with given index from vertex list.
|
Class<V> |
getVertexClass()
Return vertex class of this half-edge data structure.
|
List<V> |
getVertices()
Return the vertex list.
|
int |
numEdges()
Return number of edge.
|
int |
numFaces()
Return number of faces.
|
int |
numVertices()
Return number of vertices.
|
void |
removeEdge(Edge<?,?,?> edge)
Remove an edge from this halfedge data structure.
|
void |
removeFace(Face<?,?,?> face)
Remove a face from this halfedge data structure.
|
void |
removeVertex(Vertex<?,?,?> vertex)
Remove a vertex from this half-edge data structure.
|
String |
toString() |
public HalfEdgeDataStructure(Class<V> vClass, Class<E> eClass, Class<F> fClass)
vClass
- the half-edge data structure's vertex classeClass
- the half-edge data structure's edge classfClass
- the half-edge data structure's face classpublic final E addNewEdge()
RuntimeException
- if an instance of the edge class cannot be instantiatedpublic final List<E> addNewEdges(int n) throws RuntimeException
n
new edges to this half-edge data structure.n
- the number of edges to create and add.RuntimeException
- if instances of the edge class cannot be instantiatedpublic final F addNewFace()
RuntimeException
- if an instance of the face class cannot be instantiatedpublic final List<F> addNewFaces(int n) throws RuntimeException
n
new faces to this half-edge data structure.n
- the number of faces to create and add.RuntimeException
- if instances of the face class cannot be instantiatedpublic final V addNewVertex() throws RuntimeException
RuntimeException
- if an instance of the vertex class cannot be instantiatedpublic final List<V> addNewVertices(int n) throws RuntimeException
n
new vertices to this half-edge data structure.n
- the number of vertices to create and add.RuntimeException
- if instances of the vertex class cannot be instantiatedpublic void clear()
public final <VV extends Vertex<VV,EE,FF>,EE extends Edge<VV,EE,FF>,FF extends Face<VV,EE,FF>> HalfEdgeDataStructure<VV,EE,FF> createCombinatoriallyEquivalentCopy(Class<VV> vC, Class<EE> eC, Class<FF> fC)
VV
- the vertex type of the copyEE
- the edge type of the copyFF
- the face type of the copyvC
- the vertex class, used as runtime type tokeneC
- the edge class, used as runtime type tokenfC
- the face class, used as runtime type tokenpublic final <VV extends Vertex<VV,EE,FF>,EE extends Edge<VV,EE,FF>,FF extends Face<VV,EE,FF>,HEDS extends HalfEdgeDataStructure<VV,EE,FF>> HEDS createCombinatoriallyEquivalentCopy(HEDS heds)
heds
- The half-edge data structure to fill.public final E getEdge(int index)
index
- the indexpublic final Class<E> getEdgeClass()
public final List<E> getEdges()
public final F getFace(int index)
index
- the indexpublic final Class<F> getFaceClass()
public final List<F> getFaces()
public final Iterable<E> getNegativeEdges()
Iterable
for iterating over the positive edges.Iterable
getPositiveEdges()
public final Iterable<E> getPositiveEdges()
Iterable
for iterating over the positive edges.
If you want to loop over those edges in the edge list for which
Edge.isPositive
returns true
, you may do like this:for (E e : mySuface.getPositiveEdges()) { ... }
Iterable
public final V getVertex(int index) throws IndexOutOfBoundsException
index
- the indexIndexOutOfBoundsException
- if the index is out of rangepublic final Class<V> getVertexClass()
public final List<V> getVertices()
public final int numEdges()
public final int numFaces()
public final int numVertices()
public final void removeEdge(Edge<?,?,?> edge) throws RuntimeException
edge
is null
. Otherwise,
it is removed from the edge list and invalidated.
This means getHalfEdgeDataStructure()
will return
null
, isValid
will return false
,
and many other methods will throw an exception.
edge
will not be linked with any edges, vertices, faces after
execution of this method.edge
- the edge to remove.RuntimeException
- if edge
does not belong
to this half-edge data structurepublic final void removeFace(Face<?,?,?> face) throws RuntimeException
face
is null
. Otherwise it is
removed from the face list and invalidated.
This means getHalfEdgeDataStructure()
will return
null
, isValid()
will return false
,
and many other methods will throw an exception.
Edges which had face
as left face will now return
null
.face
- the face to removeRuntimeException
- if face
does not belong
to this half-edge data structurepublic final void removeVertex(Vertex<?,?,?> vertex)
vertex
is null
.
Otherwise, it is removed from the vertex list and invalidated.
This means getHalfEdgeDataStructure()
will return
null
, isValid()
will return false
,
and many other methods will throw an exception.
Edges which had vertex
as target vertex will now return
null
.vertex
- the vertex to remove.RuntimeException
- if vertex
does not belong
to this half-edge data structure