public class CommonAlgorithms extends Object
| Constructor and Description |
|---|
CommonAlgorithms() |
| Modifier and Type | Method and Description |
|---|---|
static float[] |
calcSmoothNormals(float[] vertices,
int[] indices)
Calculate the smooth normals for a given mesh.
|
static float[] |
gridIdxToPoint(Grid grid,
int idx)
Convert a grid index to a point.
|
static float[] |
makeNormalCoordSys(float[] normals,
int offset)
Create an ortho-normalized coordinate system where the Z-axis is aligned
with the given normal.
|
static float[] |
restoreVertices(int[] intVertices,
int[] gridIndices,
Grid grid,
float vertexPrecision)
Calculate inverse derivatives of the vertices.
|
public static float[] restoreVertices(int[] intVertices,
int[] gridIndices,
Grid grid,
float vertexPrecision)
intVertices - encoded verticesgridIndices - index of the used indexgrid - grid definitionvertexPrecision - used encoding precisionpublic static float[] gridIdxToPoint(Grid grid, int idx)
grid - gird box definitionidx - box idpublic static float[] calcSmoothNormals(float[] vertices,
int[] indices)
vertices - vertex coordinate valuesindices - vertex indicespublic static float[] makeNormalCoordSys(float[] normals,
int offset)
Note 1: This function is central to how the compressed normal data is interpreted, and it can not be changed (mathematically) without making the coder/decoder incompatible with other versions of the library!
Note 2: Since we do this for every single normal, this routine needs to be fast. The current implementation uses: 12 MUL, 1 DIV, 1 SQRT, ~6 ADD.
normals - the normal array, consecutive x,y,z coordinatesoffset - offset into the normal arrayCopyright © 2017. All rights reserved.