public class CompactTriangleMesh_6nNew extends CompactTriangleMesh
In this implementation each edge 'e' is represented as a pair e=(u, color)
-) the index 'u' of the source vertex, which is stored on 30 bits (the most significant bits)
-) the 'color' of the edge (0, 1, or 2) which is stored on 2 bits (the less significant bits, on the right)
Modifier and Type | Field and Description |
---|---|
TableWithTwoServiceBits |
table
The table storing the whole data structure.
|
Constructor and Description |
---|
CompactTriangleMesh_6nNew(int n) |
Modifier and Type | Method and Description |
---|---|
int |
getColor(int e)
Retrieve the color of edge 'e'=(u, color)
|
int |
getEdge(int v)
Return an edge incident to vertex v
|
int |
getLeftBack(int e)
Return the 'LeftBack' edge, neighbor of e=(u, color)
|
int |
getLeftFront(int e)
Return the 'LeftFront' edge of the input edge 'e=(u, v)' having color 'c'.
|
float[] |
getNormalFloat(int v)
Compute the normal to a vertex in the mesh, with simple float precision
|
int |
getRightBack(int e)
Return the 'RightBack' edge, neighbor of e=(u, color)
|
int |
getRightFront(int e)
Return the 'RightFront' edge, neighbor of e=(u, color)
|
int |
getS(int v,
int color)
Set the bit in S_{color}[v] equal to '1', for an edge outgoing from v having a given color
|
int |
getSource(int e)
Return the vertex source 'u' of edge 'e'=(u, color)
|
int |
getT(int v,
int color,
int leftRight)
Set the bit in T_{color}^{left or right}[v] equal to '1', for an edge outgoing from v having a given color
|
int |
getTarget(int e)
Retrieve the target vertex of edge 'e'=(u, color)
|
int |
getU(int v,
int color,
int leftRight)
Retrieve the reference in U_{color}^{left or right}[v], for an edge outgoing from v having a given color
|
boolean |
isEdge(int e)
Check whether an edge e=(u, color) is valid (useful for checking correctness of the data structure)
|
boolean |
isOutgoing(int e,
int v)
Check whether the edge 'e' is outgoing from vertex 'v'
|
java.lang.String |
name()
Return the name of the data structure
|
java.lang.String |
printEdge(int e)
Return a String representing an edge e=(u, color)
|
void |
setPoint(int v,
float x,
float y,
float z)
Set the geometric coordinates of vertex 'v'
|
void |
setS(int v,
int color)
Set the bit in S_{color}[v] equal to '1', for an edge outgoing from v having a given color
|
void |
setSFalse(int v,
int color)
Set the bit in S_{color}[v] equal to '1', for an edge outgoing from v having a given color
|
void |
setT(int v,
int color,
int leftRight)
Set the bit in T_{color}^{left or right}[v] equal to '1', for an edge outgoing from v having a given color
|
void |
setU(int v,
int vertexRef,
int color,
int leftRight)
Store the reference in U_{color}^{left or right}[v], for an edge outgoing from v having a given color
|
int |
sizeOfEdges() |
int |
sizeOfVertices()
Return the number of vertices in the triangulation
|
java.lang.String |
toString()
Return a String which represents the reference table encoding the data structure
|
int |
vertexDegree(int v)
Return the degree of a given vertex
|
getPoint, getX, getY, getZ, nextColor, prevColor, vectorToString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
computeFaceNormal, crossProduct
public TableWithTwoServiceBits table
All the arrays U (integer references on 30 bits), T (booleans) and S (booleans) are stored in an unique integer array of size 6*n (having n rows, 6 columns). First two columns store 'red' edges; columns 2 and 3 store 'blue' edges; last two columns store 'black' edges
public void setU(int v, int vertexRef, int color, int leftRight)
The six arrays U are stored in an unique integer array of size 6*n (having n rows, 6 columns). First two columns store 'red' edges; columns 2 and 3 store 'blue' edges; last two column store 'black' edges
v
- the index of the vertex (gives the position in the table: references are to be stored at row number 'v')vertexRef
- the reference to be stored (an integer in {0..n-1}color
- the color of the neighboring edge (incident to v): an integer in {0, 1, 2}leftRight
- an integer {0, 1} specifying the left or right column (of a given color)public void setT(int v, int color, int leftRight)
The six ('booleans') arrays T are stored as 'service bits' in an unique integer array of size 6*n (having n rows, 6 columns). First two columns deal with 'red' edges; columns 2 and 3 store service bits of 'blue' edges; last two column deal with 'black' edges
v
- the index of the vertex (gives the position in the table: references are to be stored at row number 'v')color
- the color of the neighboring edge (incident to v): an integer in {0, 1, 2}leftRight
- an integer {0, 1} specifying the left or right column (of a given color)public void setS(int v, int color)
The three ('booleans') arrays S are stored as 'service bits' in an unique integer array of size 6*n (having n rows, 6 columns). Service bits are stored in column 0, 2, 4, respectively for red, blue and black edges.
Remark: we have to use the 'second service bit', since the first service bit is already used for storing the booleans of tables T
v
- the index of the vertex (gives the position in the table: references are to be stored at row number 'v')color
- the color of the neighboring edge (incident to v): an integer in {0, 1, 2}public void setSFalse(int v, int color)
The three ('booleans') arrays S are stored as 'service bits' in an unique integer array of size 6*n (having n rows, 6 columns). Service bits are stored in column 0, 2, 4, respectively for red, blue and black edges.
Remark: we have to use the 'second service bit', since the first service bit is already used for storing the booleans of tables T
v
- the index of the vertex (gives the position in the table: references are to be stored at row number 'v')color
- the color of the neighboring edge (incident to v): an integer in {0, 1, 2}public void setPoint(int v, float x, float y, float z)
setPoint
in class CompactTriangleMesh
v
- the index of the vertexpublic int getU(int v, int color, int leftRight)
The six arrays U are stored in an unique integer array of size 6*n (having n rows, 6 columns). First two columns store 'red' edges; columns 2 and 3 store 'blue' edges; last two column store 'black' edges
v
- the index of the vertex (gives the position in the table: references are to be stored at row number 'v')color
- the color of the neighboring edge (incident to v): an integer in {0, 1, 2}leftRight
- an integer {0, 1} specifying the left or right column (of a given color)public int getT(int v, int color, int leftRight)
The six ('booleans') arrays T are stored as 'service bits' in an unique integer array of size 6*n (having n rows, 6 columns). First two columns deal with 'red' edges; columns 2 and 3 store service bits of 'blue' edges; last two column deal with 'black' edges
v
- the index of the vertex (gives the position in the table: references are to be stored at row number 'v')color
- the color of the neighboring edge (incident to v): an integer in {0, 1, 2}leftRight
- an integer {0, 1} specifying the left or right column (of a given color)public int getS(int v, int color)
The three ('booleans') arrays S are stored as 'service bits' in an unique integer array of size 6*n (having n rows, 6 columns). Service bits are stored in column 0, 2, 4, respectively for red, blue and black edges.
Remark: we have to use the 'second service bit', since the first service bit is already used for storing the booleans of tables T
v
- the index of the vertex (gives the position in the table: references are to be stored at row number 'v')color
- the color of the neighboring edge (incident to v): an integer in {0, 1, 2}public int sizeOfVertices()
TriangulationInterface
public int sizeOfEdges()
public int getLeftFront(int e)
getLeftFront
in interface WingededgeInterface
getLeftFront
in class CompactTriangleMesh
e
- an integer (on 32 bits) encoding the pair (u, c)public int getRightFront(int e)
getRightFront
in interface WingededgeInterface
getRightFront
in class CompactTriangleMesh
e
- an integer encoding (u, color)public int getLeftBack(int e)
getLeftBack
in interface WingededgeInterface
getLeftBack
in class CompactTriangleMesh
e
- an integer encoding (u, color)public int getRightBack(int e)
getRightBack
in interface WingededgeInterface
getRightBack
in class CompactTriangleMesh
e
- an integer encoding (u, color)public int getSource(int e)
By definition, just perform a bit shift (by 2)
getSource
in interface TriangulationInterface
getSource
in class CompactTriangleMesh
e
- an integer encoding (u, color)public int getColor(int e)
By definition, the color is stored in the last 2 (right-most) bits of the integer
e
- an integer encoding (u, color)public int getTarget(int e)
By definition, the color is stored in the last 2 (right-most) bits of the integer
getTarget
in interface TriangulationInterface
getTarget
in class CompactTriangleMesh
e
- an integer encoding (u, color)public int getEdge(int v)
By default, return the edge of color red: (v, 0) for all vertices except v0
getEdge
in interface TriangulationInterface
getEdge
in class CompactTriangleMesh
v
- the index of the vertexpublic boolean isOutgoing(int e, int v)
isOutgoing
in interface WingededgeInterface
isOutgoing
in class CompactTriangleMesh
e
- an integer encoding an edge (u, color)v
- the index of a vertexpublic int vertexDegree(int v)
public float[] getNormalFloat(int v)
(neighbors are traversed turning in cw direction)
v
- the index of vertexpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String printEdge(int e)
public boolean isEdge(int e)
Remark:
-) all inner edges are valid
-) on the outer face: only the edges e10, e20 and e21 are valid
public java.lang.String name()