Class ModelTriangleMeshCurvatures
- java.lang.Object
-
- gov.nih.mipav.view.renderer.J3D.model.structures.ModelTriangleMeshCurvatures
-
public class ModelTriangleMeshCurvatures extends java.lang.Object
Storage representation for a triangle mesh. Each vertex stores the coordinates and the normal vector. Each type of vertex value is stored in a separate array, however, the vertex values correspond based on index into the array. The connectivity of the vertices which form each triangle are stored in the array of indices.
-
-
Field Summary
Fields Modifier and Type Field Description private float[]
m_afMeanCurvatures
Array of mean curvature values at each vertex.private int[]
m_aiIndices
Array of triangle vertex connectivity.private javax.vecmath.Point3f[]
m_akCoordinates
Array of vertex coordinates.private javax.vecmath.Vector3f[]
m_akNormals
Array of vertex normals.private javax.vecmath.Vector3f[]
m_akTriangleNormals
Array of triangle normals.
-
Constructor Summary
Constructors Constructor Description ModelTriangleMeshCurvatures(ModelTriangleMesh kMesh)
Create a set of the min/max curvatures computed for each vertex in the triangle mesh.ModelTriangleMeshCurvatures(javax.vecmath.Point3f[] akCoordinates, int[] aiIndices)
Create a set of the min/max curvatures computed for each vertex in the triangle mesh.ModelTriangleMeshCurvatures(javax.vecmath.Point3f[] akCoordinates, javax.vecmath.Vector3f[] akNormals, int[] aiIndices)
Create a set of the min/max curvatures computed for each vertex in the triangle mesh.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
computeCurvatures()
Compute the curvatures at each vertex.private void
computeTriangleNormals()
Compute the normal vector for each triangle as the normal vector to the plane containing the vertices associated with the triangle and considering the vertices to be counterclockwise ordered for a RH rule oriented normal vector.private void
computeVertexNormals()
Compute the normal vector for each vertex as the normalized average normal vector of all the triangles of which the vertex belongs.private void
generateOrthonormalBasis(javax.vecmath.Vector3f kU, javax.vecmath.Vector3f kV, javax.vecmath.Vector3f kW)
Generate a set (any set) of orthonormal basis vectors.int[]
getCoordinateIndices()
Get the array of connectivity among the vertices which define the triangles of the mesh.javax.vecmath.Point3f[]
getCoordinates()
Get the array of coordinates at each vertex.float[]
getMeanCurvatures()
Get the array of mean curvature values at each vertex.int
getNumTriangles()
Get the number of triangles used to defined the mesh.int
getNumVertices()
Get the number of vertices used to define the mesh.javax.vecmath.Vector3f[]
getTriangleNormals()
Get the array of normal vectors for each triangle.javax.vecmath.Vector3f[]
getVertexNormals()
Get the array of normal vectors at each vertex.
-
-
-
Field Detail
-
m_afMeanCurvatures
private float[] m_afMeanCurvatures
Array of mean curvature values at each vertex.
-
m_aiIndices
private final int[] m_aiIndices
Array of triangle vertex connectivity.
-
m_akCoordinates
private final javax.vecmath.Point3f[] m_akCoordinates
Array of vertex coordinates.
-
m_akNormals
private final javax.vecmath.Vector3f[] m_akNormals
Array of vertex normals.
-
m_akTriangleNormals
private final javax.vecmath.Vector3f[] m_akTriangleNormals
Array of triangle normals.
-
-
Constructor Detail
-
ModelTriangleMeshCurvatures
public ModelTriangleMeshCurvatures(ModelTriangleMesh kMesh)
Create a set of the min/max curvatures computed for each vertex in the triangle mesh. The triangle mesh is specified by the input ModelTrianglMesh instance.- Parameters:
kMesh
- ModelTriangleMesh Input triangle mesh which contains the vertex coordinates and vertex triangle connectivity information.
-
ModelTriangleMeshCurvatures
public ModelTriangleMeshCurvatures(javax.vecmath.Point3f[] akCoordinates, int[] aiIndices)
Create a set of the min/max curvatures computed for each vertex in the triangle mesh. The triangle mesh is specified by the coordinates of the vertices and the vertex array indices which define the triangle connectivity. From this information, the normal vectors of each triangle can be computed and from that the normal vectors at each vertex can be computed.- Parameters:
akCoordinates
- array of vertex coordinatesaiIndices
- array of vertex indices given triangle connectivity
-
ModelTriangleMeshCurvatures
public ModelTriangleMeshCurvatures(javax.vecmath.Point3f[] akCoordinates, javax.vecmath.Vector3f[] akNormals, int[] aiIndices)
Create a set of the min/max curvatures computed for each vertex in the triangle mesh. The triangle mesh is specified by the coordinates of the vertices, the normal vectors at each vertex, and the vertex array indices which define the triangle connectivity.- Parameters:
akCoordinates
- array of vertex coordinatesakNormals
- array of vertex normals; Must have at leat the same number of elements as does the akCoordinates array where each element in this normal array corresponds to the vertex coordinate array element at the same index.aiIndices
- array of vertex indices given triangle connectivity
-
-
Method Detail
-
getCoordinateIndices
public int[] getCoordinateIndices()
Get the array of connectivity among the vertices which define the triangles of the mesh. Each group of three values in the array contains an index into the vertex array for the vertcies which define a single triangle in the mesh.- Returns:
- int[] Array of vertex indices. Each index in the array should be a non-negative value less than the value returned by getNumVertices(). The dimension of this array should equal three times the value returned by getNumTriangles().
-
getCoordinates
public javax.vecmath.Point3f[] getCoordinates()
Get the array of coordinates at each vertex.- Returns:
- Point3f[] Array of 3D vertex coordinates. The dimension of this array should equal the value returned by getNumVertices().
-
getMeanCurvatures
public float[] getMeanCurvatures()
Get the array of mean curvature values at each vertex.- Returns:
- array of vertex mean curvature values where individual values may be signed; the dimension of this array should equal the value returned by getNumVertices().
-
getNumTriangles
public int getNumTriangles()
Get the number of triangles used to defined the mesh.- Returns:
- number of triangles
-
getNumVertices
public int getNumVertices()
Get the number of vertices used to define the mesh.- Returns:
- number of vertices
-
getTriangleNormals
public javax.vecmath.Vector3f[] getTriangleNormals()
Get the array of normal vectors for each triangle.- Returns:
- Vector3f[] Array of 3D normal vectors. The dimension of this array should equal the value returned by getNumTriangles().
-
getVertexNormals
public javax.vecmath.Vector3f[] getVertexNormals()
Get the array of normal vectors at each vertex.- Returns:
- Vector3f[] Array of 3D normal vectors. The dimension of this array should equal the value returned by getNumVertices().
-
computeCurvatures
private void computeCurvatures()
Compute the curvatures at each vertex. Description of the algorithm is found in the embedded comments.
-
computeTriangleNormals
private void computeTriangleNormals()
Compute the normal vector for each triangle as the normal vector to the plane containing the vertices associated with the triangle and considering the vertices to be counterclockwise ordered for a RH rule oriented normal vector. This sets the elements in the m_akTriangleNormals array.
-
computeVertexNormals
private void computeVertexNormals()
Compute the normal vector for each vertex as the normalized average normal vector of all the triangles of which the vertex belongs. Do not call this method unless the m_akTriangleNormals array contains valid normalized normal vectors. This sets the elements in the m_akNormals array.
-
generateOrthonormalBasis
private void generateOrthonormalBasis(javax.vecmath.Vector3f kU, javax.vecmath.Vector3f kV, javax.vecmath.Vector3f kW)
Generate a set (any set) of orthonormal basis vectors.- Parameters:
kU
- output vector in orthonormal basis (perpendicular to kW)kV
- output vector in orthonormal basis (equal to kW cross kU)kW
- input non-zero vector
-
-