vrml.eai.field
Class EventOutSFRotation

java.lang.Object
  extended by vrml.eai.field.BaseField
      extended by vrml.eai.field.EventOut
          extended by vrml.eai.field.EventOutSFRotation

public abstract class EventOutSFRotation
extends EventOut

Reference to a SFRotation event-out slot. Use this class to read values from SFRotation event-out slots.

The following example demonstrates how to get the current orientation of the active Viewpoint from a ProximitySensor, and prints it to the console:

 vrml.eai.Node proximitySensor = ...;
 vrml.eai.field.EventOutSFRotation orientation_changed = (vrml.eai.field.EventOutSFRotation)proximitySensor.getEventOut("orientation_changed");
 float[] rotation = orientation_changed.getValue();
 System.out.println("x = " + rotation[0] + ", y = " + rotation[1] + ", z = " + rotation[2] + ", angle = " + rotation[3]);
 


Field Summary
 
Fields inherited from class vrml.eai.field.BaseField
MFColor, MFFloat, MFInt32, MFNode, MFRotation, MFString, MFTime, MFVec2f, MFVec3f, SFBool, SFColor, SFFloat, SFImage, SFInt32, SFNode, SFRotation, SFString, SFTime, SFVec2f, SFVec3f
 
Constructor Summary
protected EventOutSFRotation()
          Default Constructor.
 
Method Summary
abstract  float[] getValue()
          Returns the current value of the SFRotation event-out slot.
abstract  void getValue(float[] value)
          Returns the current value of the SFRotation event-out slot.
 
Methods inherited from class vrml.eai.field.EventOut
addVrmlEventListener, getUserData, removeVrmlEventListener, setUserData
 
Methods inherited from class vrml.eai.field.BaseField
getType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventOutSFRotation

protected EventOutSFRotation()
Default Constructor. This method is protected, i.e. you cannot create new instances of this class. The only way to get instances is via the Node.getEventOut(java.lang.String) method.

Method Detail

getValue

public abstract float[] getValue()
Returns the current value of the SFRotation event-out slot.

The following example demonstrates how to get the current orientation of the active Viewpoint from a ProximitySensor, and prints it to the console:

 vrml.eai.Node proximitySensor = ...;
 vrml.eai.field.EventOutSFRotation orientation_changed = (vrml.eai.field.EventOutSFRotation)proximitySensor.getEventOut("orientation_changed");
 float[] rotation = orientation_changed.getValue();
 System.out.println("x = " + rotation[0] + ", y = " + rotation[1] + ", z = " + rotation[2] + ", angle = " + rotation[3]);
 

Returns:
The rotation as an array of four floats. The first three elements contain the x, y and z coordinate of the rotation axis. The fourth element contains the rotation angle, in radians.

getValue

public abstract void getValue(float[] value)
                       throws java.lang.ArrayIndexOutOfBoundsException
Returns the current value of the SFRotation event-out slot.

The following example demonstrates how to get the current orientation of the active Viewpoint from a ProximitySensor, and prints it to the console:

 vrml.eai.Node proximitySensor = ...;
 vrml.eai.field.EventOutSFRotation orientation_changed = (vrml.eai.field.EventOutSFRotation)proximitySensor.getEventOut("orientation_changed");
 float[] rotation = new float[4];
 orientation_changed.getValue(rotation);
 System.out.println("x = " + rotation[0] + ", y = " + rotation[1] + ", z = " + rotation[2] + ", angle = " + rotation[3]);
 

Parameters:
value - An array of at least four float elements that gets filled with the rotation. The first three elements get filled with the x, y and z coordinate of the rotation axis. The fourth element gets filled with the rotation angle, in radians.
Throws:
java.lang.ArrayIndexOutOfBoundsException - when the value array has less then four elements.