|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectm3g04.mesh.Bezier
public class Bezier
Calculations for Bezier surfaces.
| Field Summary | |
|---|---|
private short[] |
diffsS
Buffers for storing intermediate data. |
private short[] |
diffsT
Buffers for storing intermediate data. |
private short[] |
intermediatePointsS
Buffers for storing intermediate data. |
private short[] |
intermediatePointsT
Buffers for storing intermediate data. |
private int |
numVertices
Number of vertices per curve. |
static int |
REFLECT_X
Reflection on the x axis. |
static int |
REFLECT_Y
Reflection on the y axis. |
static int |
REFLECT_Z
Reflection on the z axis. |
private float |
step1
Pre-computed values for curve evaluation. |
private float |
step2
Pre-computed values for curve evaluation. |
private float |
step3
Pre-computed values for curve evaluation. |
private int |
steps
Number of interpolation steps. |
private short[] |
tangentsS
Buffers for storing intermediate data. |
private short[] |
tangentsT
Buffers for storing intermediate data. |
| Constructor Summary | |
|---|---|
Bezier(int steps,
boolean createNormals)
Initializes class. |
|
| Method Summary | |
|---|---|
void |
createNormals(short[] controlPoints,
short[] controlIndices,
short[] normals,
int offset)
Calculates normals. |
void |
createPositions(short[] controlPoints,
short[] controlIndices,
short[] positions,
int offset)
Calculates the vertex positions of a cubic Bezier surface (16 control points). |
void |
createTexCoords(byte[] texCoords,
int offset,
boolean windingCcw)
Calculates texture coordinates. |
void |
createTriStrips(int offset,
int[] triStrips,
int[] triLengths,
int triOffset,
boolean windingCcw)
Calculates triangle strips for the evaluated Bezier surface. |
static void |
cross(short[] result,
int offset,
short[] lhs,
int lhsOffset,
short[] rhs,
int rhsOffset)
Builds the cross product of two vectors. |
static void |
evaluateCubicCurve(short[] cpoints,
int p0,
int p1,
int p2,
int p3,
short[] result,
int offset,
int steps,
float step1,
float step2,
float step3)
Evaluates a cubic Bezier curve (four control points). |
static void |
evaluateQuadraticCurve(short[] cpoints,
int p0,
int p1,
int p2,
short[] result,
int offset,
int steps,
float step1,
float step2)
Evaluates a quadratic Bezier curve (three control points). |
static void |
reflect(short[] positions,
int offset,
int newOffset,
int length,
int axes)
Reflects an array of vectors around the given axis. |
static void |
sub(short[] result,
int offset,
short[] points,
int lhs,
int rhs)
Subtracts two vectors. |
static int |
verticesPerCurve(int steps)
Returns the number of vertices for a curve that is evaluated with the given number of steps. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int REFLECT_X
public static final int REFLECT_Y
public static final int REFLECT_Z
private int steps
private int numVertices
private float step1
private float step2
private float step3
private short[] intermediatePointsS
private short[] intermediatePointsT
private short[] diffsS
private short[] diffsT
private short[] tangentsS
private short[] tangentsT
| Constructor Detail |
|---|
public Bezier(int steps,
boolean createNormals)
steps - number of interpolation steps.createNormals - true to create normals, false otherwise.| Method Detail |
|---|
public static int verticesPerCurve(int steps)
steps - number of interpolation values.
public void createPositions(short[] controlPoints,
short[] controlIndices,
short[] positions,
int offset)
controlPoints - array of control points.controlIndices - array of indices to the control points.positions - resulting vertex positions.offset - offset into the positions array.
public static void evaluateCubicCurve(short[] cpoints,
int p0,
int p1,
int p2,
int p3,
short[] result,
int offset,
int steps,
float step1,
float step2,
float step3)
cpoints - array with control points.p0 - index to first control point.p1 - index to second control point.p2 - index to third control point.p3 - index to fourth control point.result - evaluated points.offset - offset into the result array.steps - number of interpolation steps.step1 - pre-computed step value (1.0f/steps).step2 - pre-computed step value (1.0f/steps*steps).step3 - pre-computed step value (1.0f/steps*steps*steps).
public void createTriStrips(int offset,
int[] triStrips,
int[] triLengths,
int triOffset,
boolean windingCcw)
offset - offset to the array with vertex positions.triStrips - resulting triangle strips.triLengths - resulting triangle lengths.triOffset - offset to the triangle arrays.windingCcw - true to connect triangles counter-clockwise,
false otherwise.
public void createTexCoords(byte[] texCoords,
int offset,
boolean windingCcw)
texCoords - resulting texture coordinates.offset - offset to the texture array.windingCcw - true to connect triangles counter-clockwise,
false otherwise.
public void createNormals(short[] controlPoints,
short[] controlIndices,
short[] normals,
int offset)
controlPoints - array of control points for the Bezier
surface.controlIndices - array of indices to the control points.normals - resulting normals.offset - offset to the normals array.
public static void evaluateQuadraticCurve(short[] cpoints,
int p0,
int p1,
int p2,
short[] result,
int offset,
int steps,
float step1,
float step2)
cpoints - array with control points.p0 - index to first control point.p1 - index to second control point.p2 - index to third control point.result - evaluated points.offset - offset into the result array.steps - number of interpolation steps.step1 - pre-computed step value (1.0f/steps).step2 - pre-computed step value (1.0f/steps*steps).
public static void sub(short[] result,
int offset,
short[] points,
int lhs,
int rhs)
result - array for result.offset - offset to the result array.points - array with input vectors.lhs - index to minuend.rhs - index to subtrahend.
public static void cross(short[] result,
int offset,
short[] lhs,
int lhsOffset,
short[] rhs,
int rhsOffset)
result - array for result.offset - offset to the result array.lhs - array for left-hand side vector.lhsOffset - index to left-hand side vector.rhs - array for right-hand side vector.rhsOffset - index to right-hand side vector.
public static void reflect(short[] positions,
int offset,
int newOffset,
int length,
int axes)
positions - input values.offset - offset to input values.newOffset - offset to the result.length - number of vectors.axes - reflection axes. Several can be combined with OR.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||