Package vrml.field
Class MFRotation
java.lang.Object
vrml.Field
vrml.MField
vrml.field.MFRotation
- All Implemented Interfaces:
Cloneable
VRML JSAI type class containing multiple rotation fields.
Internally, the class stores the values as a single, flat array so that is the most efficient method to use to avoid reallocation. All methods make internal copies of the values.
- Version:
- $Revision: 1.6 $
- Author:
- Alan Hudson, Justin Couch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final int
How much should we increment the array by when there is an add or insert request.protected float[]
The rot valuesFields inherited from class vrml.MField
numElements
Fields inherited from class vrml.Field
valueChanged
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new empty rotation.MFRotation
(float[] rots) Construct a new rotation array based on all the given values.MFRotation
(float[][] rots) Construct a new rotation array based on all the given values.MFRotation
(int size, float[] rots) Construct a new rotation array based on a fraction of the items supplied. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addValue
(float x, float y, float z, float a) Append the components as a new rotation value to the end of this field.void
addValue
(ConstSFRotation rot) Append the field as a new rot value to the end of this field.void
addValue
(SFRotation rot) Append the field as a new rot value to the end of this field.void
clear()
Clear the field of all elementsclone()
Make a clone of this object.void
delete
(int index) Remove the element at the given position and shift any other items down.void
get1Value
(int index, float[] rots) Copy the value of the rotation at the given index into the user array.void
get1Value
(int index, SFRotation rot) Copy the rotation value at the given index into the supplied field.void
getValue
(float[] rots) Copy the value of this field into the given flat array.void
getValue
(float[][] rots) Copy the values from this field into the given array.void
insertValue
(int index, float x, float y, float z, float a) Insert the rotation represented by the components at the given position in the array.void
insertValue
(int index, ConstSFRotation rot) Insert the rotation represented by the given field at the given position in the array.void
insertValue
(int index, SFRotation rot) Insert the rotation represented by the given field at the given position in the array.void
set1Value
(int index, float x, float y, float z, float a) Set the element at the given index with the given rot components.void
set1Value
(int index, ConstSFRotation rot) Set the element at the given index with the value from the given field.void
set1Value
(int index, SFRotation rot) Set the element at the given index with the value from the given field.void
setValue
(float[] rots) Set the field to the new values.void
setValue
(float[][] rots) Set the field to the new values.void
setValue
(int size, float[] rots) Set the value of this field given limited array of rots.void
setValue
(ConstMFRotation rots) Set the value of this field to the values in the given field.void
setValue
(MFRotation rots) Set the value of this field based on the values in the given field.toString()
Create a string representation of the field values.
-
Field Details
-
ARRAY_INC
protected static final int ARRAY_INCHow much should we increment the array by when there is an add or insert request. This value is array items, not elements.- See Also:
-
data
protected float[] dataThe rot values
-
-
Constructor Details
-
MFRotation
public MFRotation()Construct a new empty rotation. -
MFRotation
public MFRotation(float[][] rots) Construct a new rotation array based on all the given values.- Parameters:
rots
- The source rotation values
-
MFRotation
public MFRotation(float[] rots) Construct a new rotation array based on all the given values.- Parameters:
rots
- The source rotation values
-
MFRotation
public MFRotation(int size, float[] rots) Construct a new rotation array based on a fraction of the items supplied.- Parameters:
size
- The number of rotations is size / 4.rots
- The source rotation values
-
-
Method Details
-
getValue
public void getValue(float[][] rots) Copy the values from this field into the given array.- Parameters:
rots
- The target array to copy values into
-
getValue
public void getValue(float[] rots) Copy the value of this field into the given flat array.- Parameters:
rots
- The target array to copy values into
-
get1Value
public void get1Value(int index, float[] rots) Copy the value of the rotation at the given index into the user array.- Parameters:
index
- The index in the array of values to readrots
- The array to copy the rotation value to
-
get1Value
Copy the rotation value at the given index into the supplied field.- Parameters:
index
- The index in the array of values to readrot
- The field to copy the rotation value to
-
setValue
public void setValue(float[][] rots) Set the field to the new values.- Parameters:
rots
- The new rot values to use
-
setValue
public void setValue(float[] rots) Set the field to the new values.- Parameters:
rots
- The new rot values to use
-
setValue
public void setValue(int size, float[] rots) Set the value of this field given limited array of rots. x1, y1, z1, x2, y2, z2, ....- Parameters:
size
- The number of rots is size / 4.rots
- Rotation 4-tuples flattened.
-
setValue
Set the value of this field based on the values in the given field.- Parameters:
rots
- The field to copy from
-
setValue
Set the value of this field to the values in the given field.- Parameters:
rots
- The field to copy from
-
set1Value
Set the element at the given index with the value from the given field.- Parameters:
index
- The index of the element to setrot
- The field to copy the data from
-
set1Value
Set the element at the given index with the value from the given field.- Parameters:
index
- The index of the element to setrot
- The field to copy the data from
-
set1Value
public void set1Value(int index, float x, float y, float z, float a) Set the element at the given index with the given rot components.- Parameters:
index
- The index of the element to setx
- The x component to usey
- The y component to usez
- The z component to usea
- The angle component
-
addValue
Append the field as a new rot value to the end of this field.- Parameters:
rot
- The field to append
-
addValue
Append the field as a new rot value to the end of this field.- Parameters:
rot
- The field to append
-
addValue
public void addValue(float x, float y, float z, float a) Append the components as a new rotation value to the end of this field.- Parameters:
x
- The x component to usey
- The y component to usez
- The z component to usea
- The angle component
-
insertValue
Insert the rotation represented by the given field at the given position in the array.- Parameters:
index
- The position to insert the valuerot
- The rot field to insert
-
insertValue
Insert the rotation represented by the given field at the given position in the array.- Parameters:
index
- The position to insert the valuerot
- The rot field to insert
-
insertValue
public void insertValue(int index, float x, float y, float z, float a) Insert the rotation represented by the components at the given position in the array.- Parameters:
index
- The position to insert the valuex
- The x component to usey
- The y component to usez
- The z component to usea
- The angle component
-
clear
-
delete
-
toString
-
clone
-