public class CompactHalfedge
extends java.lang.Object
implements Jcg.mesh.arraybased.HalfedgeInterface
Modifier and Type | Field and Description |
---|---|
float[] |
coordF
a table of size 3*V storing geometric coordinates of vertices
|
int[] |
O
opposite table of size 3*F: store for each corner its opposite corner
|
int[] |
V
vertex table of size 3*F: store for each corner its incident vertex
|
Constructor and Description |
---|
CompactHalfedge(int nVertices,
int nHalfedges)
Initialize the data structure
|
CompactHalfedge(int n,
int[] V,
int[] O,
float[] coordF)
Create a Compact Halfedge representation of a (closed) triangle mesh.
|
Modifier and Type | Method and Description |
---|---|
boolean |
adjacent(int v,
int w)
Check whether two vertices 'v' and 'w' are adjacent.
|
boolean |
checkValidity()
Check the combinatorial validity of the data structure
|
static float[] |
crossProduct(float[] a,
float[] b) |
int |
face(int h)
Return the triangle containing halfedge 'h'
|
int |
getCornerInFace(int f,
int index)
Return the i-th corner in a face 'f'
|
int |
getEdge(int v)
Return a corner incident to vertex 'v'
|
java.lang.String |
getMemoryCost()
Get the total memory cost for storing the combinatorial structure (no geometry)
|
int[] |
getNeighborsArray(int v)
Return the list of the neighbors of a given vertex (same implementation as below)
|
int |
getNext(int h)
Return the next halfedge in the triangle containing 'h'
|
float[] |
getNormalFloat(int v)
Return the normal to a vertex in the mesh.
|
int |
getOpposite(int h)
Return the opposite halfedge of 'h'
|
int |
getOppPrev(int e)
Get the half-edge which is given by: getOpposite(getPrev(e))
|
java.util.List<java.lang.Integer> |
getOutgoingHalfedges(int v)
Return the list of the (outgoing) halfedges incident to a vertex
|
float[] |
getPoint(int v)
Return the geometric coordinates of vertex v (simple float precision)
|
int |
getPrev(int h)
Return the previous halfedge of 'h'
|
int |
getSource(int h)
Return the origin vertex incident to the halfedge 'h'
|
int |
getTarget(int h)
Return the target vertex incident to the halfedge 'h'
|
float |
getX(int v)
Return the x-coordinate of vertex v
|
float |
getY(int v)
Return the y-coordinate of vertex v
|
float |
getZ(int v)
Return the z-coordinate of vertex v
|
int[] |
listing(int v)
Return the list of the neighbors of a given vertex
|
java.lang.String |
name()
Return the name of the data structure
|
void |
print() |
static void |
printTable(int[] t) |
void |
setEdge(int v,
int h)
Set an incident halfedge for 'v'
|
void |
setNext(int e,
int eNext)
Set the next of an half edge
|
void |
setOpposite(int h,
int o)
Set the opposite halfedge of a given corner 'h'
|
void |
setPoint(int v,
float x,
float y,
float z)
Set the geometric coordinates of vertex v
|
void |
setVertex(int h,
int vertex)
Set the incidence between halfedge 'h' and vertex 'v'
|
int |
sizeOfHalfedges()
Return the number of half edges
|
int |
sizeOfVertices()
Return the number of vertices
|
java.lang.String |
toString()
Return a String describing the data structure references
|
java.lang.String |
vectorToString(float[] u) |
int |
vertexDegree(int v)
Return the degree of a given vertex
|
int |
vertexDegreeSlow(int v)
Return the degree of a given vertex
Slow version: with function calls
|
public int[] V
public int[] O
public float[] coordF
public CompactHalfedge(int n, int[] V, int[] O, float[] coordF)
n
- number of verticesV
- vertex table (an array of size 3*F)O
- opposite table (an array of size 3*F)coordF
- an array of size 3*n storing the geometric coordinates of the 'n' verticespublic CompactHalfedge(int nVertices, int nHalfedges)
public void setVertex(int h, int vertex)
setVertex
in interface Jcg.mesh.arraybased.HalfedgeInterface
h
- halfedgevertex
- vertex index to the corner 'h'public void setOpposite(int h, int o)
setOpposite
in interface Jcg.mesh.arraybased.HalfedgeInterface
h
- halfedgeo
- opposite halfedgepublic void setEdge(int v, int h)
setEdge
in interface Jcg.mesh.arraybased.HalfedgeInterface
v
- a vertexh
- a halfedge incident to 'v'public void setPoint(int v, float x, float y, float z)
setPoint
in interface Jcg.mesh.arraybased.HalfedgeInterface
v
- the index of the vertexpublic void setNext(int e, int eNext)
setNext
in interface Jcg.mesh.arraybased.HalfedgeInterface
public int face(int h)
public int getOpposite(int h)
getOpposite
in interface Jcg.mesh.arraybased.HalfedgeInterface
public int getNext(int h)
getNext
in interface Jcg.mesh.arraybased.HalfedgeInterface
public int getPrev(int h)
getPrev
in interface Jcg.mesh.arraybased.HalfedgeInterface
public int getEdge(int v)
getEdge
in interface Jcg.mesh.arraybased.TriangulationInterface
v
- a vertexpublic int getOppPrev(int e)
getOppPrev
in interface Jcg.mesh.arraybased.HalfedgeInterface
public int getTarget(int h)
getTarget
in interface Jcg.mesh.arraybased.TriangulationInterface
public int getSource(int h)
getSource
in interface Jcg.mesh.arraybased.TriangulationInterface
public int getCornerInFace(int f, int index)
f
- a faceindex
- an index in [0, 1, 2]public float[] getPoint(int v)
getPoint
in interface Jcg.mesh.arraybased.TriangulationInterface
v
- the index of the vertexpublic float getX(int v)
public float getY(int v)
public float getZ(int v)
public int sizeOfVertices()
sizeOfVertices
in interface Jcg.mesh.arraybased.HalfedgeInterface
sizeOfVertices
in interface Jcg.mesh.arraybased.NavigationInterface
sizeOfVertices
in interface Jcg.mesh.arraybased.TriangulationInterface
public int sizeOfHalfedges()
sizeOfHalfedges
in interface Jcg.mesh.arraybased.HalfedgeInterface
public java.util.List<java.lang.Integer> getOutgoingHalfedges(int v)
Remark: Half-edges are listed in cw order
getOutgoingHalfedges
in interface Jcg.mesh.arraybased.HalfedgeInterface
public int[] getNeighborsArray(int v)
public int[] listing(int v)
listing
in interface Jcg.mesh.arraybased.NavigationInterface
public int vertexDegree(int v)
vertexDegree
in interface Jcg.mesh.arraybased.NavigationInterface
public int vertexDegreeSlow(int v)
public float[] getNormalFloat(int v)
getNormalFloat
in interface Jcg.mesh.arraybased.NavigationInterface
public boolean adjacent(int v, int w)
adjacent
in interface Jcg.mesh.arraybased.NavigationInterface
public java.lang.String toString()
toString
in class java.lang.Object
public boolean checkValidity()
public java.lang.String name()
name
in interface Jcg.mesh.arraybased.NavigationInterface
public java.lang.String getMemoryCost()
getMemoryCost
in interface Jcg.mesh.arraybased.HalfedgeInterface
public static float[] crossProduct(float[] a, float[] b)
crossProduct
in interface Jcg.mesh.arraybased.NavigationInterface
public java.lang.String vectorToString(float[] u)
public static void printTable(int[] t)
public void print()