Xj3D 2.0 VRML/X3D Code API

org.web3d.x3d.sai
Interface MFRotation

All Superinterfaces:
MField, X3DField

public interface MFRotation
extends MField

Representation of a MFRotation field.

Rotation values are specified according to the VRML IS Specification Section 5.8 SFRotation and MFRotation.

Version:
1.0 30 April 1998

Method Summary
 void append(float[] value)
          Places a new value at the end of the existing value, increasing the field length accordingly.
 void clear()
          Removes all values in the field and changes the field size to zero.
 void get1Value(int index, float[] vec)
          Get the value of a particular rotation value in the event out array.
 void getValue(float[] vec)
          Get the values of the event out flattened into a single 1D array.
 void getValue(float[][] vec)
          Write the value of the event out to the given array.
 void insertValue(int index, float[] value)
          Inserts a value into an existing index of the field.
 void removeValue(int index)
          Removes one value from the field.
 void set1Value(int index, float[] value)
          Set a particular rotation in the given eventIn array.
 void setValue(int numRotations, float[] value)
          Set the value of the array of rotations.
 void setValue(int numRotations, float[][] value)
          Set the value of the array of rotations.
 
Methods inherited from interface org.web3d.x3d.sai.MField
getSize
 
Methods inherited from interface org.web3d.x3d.sai.X3DField
addX3DEventListener, getDefinition, getUserData, isReadable, isWritable, removeX3DEventListener, setUserData
 

Method Detail

append

void append(float[] value)
Places a new value at the end of the existing value, increasing the field length accordingly.

Parameters:
value - The value to append value[0] = X component [0-1]
value[1] = Y component [0-1]
value[2] = Z component [0-1]
value[3] = Angle of rotation [-PI - PI] (nominally).
Throws:
java.lang.ArrayIndexOutOfBoundsException - The provided array was too small

clear

void clear()
Removes all values in the field and changes the field size to zero.


getValue

void getValue(float[][] vec)
Write the value of the event out to the given array.

Parameters:
vec - The array to be filled in where
value[i][0] = X component [0-1]
value[i][1] = Y component [0-1]
value[i][2] = Z component [0-1]
value[i][3] = Angle of rotation [-PI - PI] (nominally).
Throws:
java.lang.ArrayIndexOutOfBoundsException - The provided array was too small

getValue

void getValue(float[] vec)
Get the values of the event out flattened into a single 1D array. The array must be at least 4 times the size of the array.

Parameters:
vec - The array to be filled in where the value[i + 0] = X component [0-1]
value[i + 1] = Y component [0-1]
value[i + 2] = Z component [0-1]
value[i + 3] = Angle of rotation [-PI - PI] (nominally).
Throws:
java.lang.ArrayIndexOutOfBoundsException - The provided array was too small

get1Value

void get1Value(int index,
               float[] vec)
Get the value of a particular rotation value in the event out array.

Parameters:
index - The position to get the vectory value from.
vec - The array to place the value in where. vec[0] = X component [0-1]
vec[1] = Y component [0-1]
vec[2] = Z component [0-1]
vec[3] = Angle of rotation [-PI - PI] (nominally).
Throws:
java.lang.ArrayIndexOutOfBoundsException - The provided array was too small or the index was outside the current data array bounds.

insertValue

void insertValue(int index,
                 float[] value)
                 throws java.lang.ArrayIndexOutOfBoundsException
Inserts a value into an existing index of the field. Current field values from the index to the end of the field are shifted down and the field length is increased by one to accomodate the new element. If the index is out of the bounds of the current field an ArrayIndexOutofBoundsException will be generated.

Parameters:
index - The position at which to insert
value - The new element to insert value[0] = X component [0-1]
value[1] = Y component [0-1]
value[2] = Z component [0-1]
value[3] = Angle of rotation [-PI - PI] (nominally).
Throws:
java.lang.ArrayIndexOutOfBoundsException - The index was outside the current field size.
java.lang.ArrayIndexOutOfBoundsException - The provided array was too small

removeValue

void removeValue(int index)
                 throws java.lang.ArrayIndexOutOfBoundsException
Removes one value from the field. Values at indices above the removed element will be shifted down by one and the size of the field will be reduced by one.

Parameters:
index - The position of the value to remove.
Throws:
java.lang.ArrayIndexOutOfBoundsException - The index was outside the current field size.

setValue

void setValue(int numRotations,
              float[] value)
Set the value of the array of rotations. Input is an array of floats values in order required to specify an SFRotation. If value[i] does not contain at least four values an ArrayIndexOutOfBoundsException will be generated. If value[i] contains more than four items only the first four values will be used and the rest ignored.

Parameters:
numRotations - The number of rotations to copy from this array
value - The array of rotation values where
value[i] = X component [0-1]
value[i+1] = Y component [0-1]
value[i+2] = Z component [0-1]
value[i+3] = Angle of rotation [-PI - PI] (nominally).
Throws:
java.lang.ArrayIndexOutOfBoundsException - A value did not contain at least four values for the rotation

setValue

void setValue(int numRotations,
              float[][] value)
Set the value of the array of rotations. Input is an array of floats values in order required to specify an SFRotation. If value[i] does not contain at least four values an ArrayIndexOutOfBoundsException will be generated. If value[i] contains more than four items only the first four values will be used and the rest ignored.

Parameters:
numRotations - The number of rotations to copy from this array
value - The array of rotation values where
value[i][0] = X component [0-1]
value[i][1] = Y component [0-1]
value[i][2] = Z component [0-1]
value[i][3] = Angle of rotation [-PI - PI] (nominally).
Throws:
java.lang.ArrayIndexOutOfBoundsException - A value did not contain at least four values for the rotation

set1Value

void set1Value(int index,
               float[] value)
Set a particular rotation in the given eventIn array. To the VRML world this will generate a full MFRotation event with the nominated index value changed.

The value array must contain at least four elements. If the array contains more than 4 values only the first four values will be used and the rest ignored.

If the index is out of the bounds of the current array of data values or the array of values does not contain at least 4 elements an ArrayIndexOutOfBoundsException will be generated.

Parameters:
index - The position to set the rotation value
value - The array of rotation values where
value[0] = X component [0-1]
value[1] = Y component [0-1]
value[2] = Z component [0-1]
value[3] = Angle of rotation [-PI - PI] (nominally).
Throws:
java.lang.ArrayIndexOutOfBoundsException - A value did not contain at least four values for the rotation

Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium