Class WandViewBehavior
- java.lang.Object
-
- javax.media.j3d.SceneGraphObject
-
- javax.media.j3d.Node
-
- javax.media.j3d.Leaf
-
- javax.media.j3d.Behavior
-
- com.sun.j3d.utils.behaviors.vp.ViewPlatformBehavior
-
- com.sun.j3d.utils.behaviors.vp.WandViewBehavior
-
public class WandViewBehavior extends ViewPlatformBehavior
Manipulates view platform transforms using a motion-tracked wand or mouse equipped with a six degree of freedom (6DOF) sensor. An optional two axis (2D) valuator sensor is also directly supported. Default operation is set up to enable both direct manipulation of the view transform and translation back and forth along the direction the 6DOF sensor is pointing; rotation is handled by the 2D valuator if available. An arbitrary number of sensors and action bindings can be customized by accessing this behavior'sSensorEventAgentdirectly.This behavior can be instantiated from the configuration file read by
ConfiguredUniverseand fully configured using theViewPlatformBehaviorPropertiescommand to set the properties described below, but neitherConfiguredUniversenorSimpleUniverseare required by this behavior. Conventionalsetandgetaccessors are provided for configuring this behavior directly; these methods have the same names as the properties but are prefixed withgetandset. Property values are spelled with mixed case strings while the corresponding constant field names for the conventional accessors are spelled with upper case strings and underscores.Sensor6Dis the 6DOF sensor to use. This can also be set directly with the appropriate constructor. This sensor must generate 6 degree of freedom position and orientation reads relative to the tracker base in physical units. By default this behavior provides an echo for the 6DOF sensor which indicates its position and orientation in the virtual world; the echo attributes can be set by theEchoType,EchoSize,EchoColor, andEchoTransparencyproperties. See also theNominalSensorRotationproperty, and thesetHotSpotmethod of theSensorclass.Sensor2Dis an optional 2D valuator to use in conjunction with the 6DOF sensor. This can be set directly with the appropriate constructor. The valuator should generate X and Y reads ranging from [-1.0 .. +1.0], with a nominal (deadzone) value of 0.0. The default configuration expects to find these values along the translation components of the read matrix, at indices 3 and 7, but these indices can be also be specified by theMatrixIndices2Dproperty.ButtonAction6Dsets an action for a specific button on a 6DOF sensor. The actions available are:-
GrabView- Directly manipulates the view platform by moving it in inverse response to the sensor's position and orientation, producing the effect of attaching the virtual world to the sensor's movements. If a button is available then this action is bound to button 0 by default. -
TranslateForward- Translates the view platform forward along the direction the sensor is pointing; the virtual world appears to move towards the sensor. The default is button 1 if two buttons are available. Related properties areTranslationSpeed,AccelerationTime,ConstantSpeedTime, andFastSpeedFactor. -
TranslateBackward- Translates the view platform backwards along the direction the sensor is pointing; the virtual world appears to move away from the sensor. The default is button 2 if three buttons are available. -
RotateCCW- Rotates the view platform counter-clockwise about a Y axis; the virtual world appears to rotate clockwise. This action is not assigned by default. Related properties areRotationSpeed,RotationCoords,TransformCenterSource,TransformCenter, andAccelerationTime. -
RotateCW- Rotates the view platform clockwise about a Y axis; the virtual world appears to rotate counter-clockwise. This action is not assigned by default. -
ScaleUp- Scales the view platform larger so that the virtual world appears to grow smaller. This action is not assigned by default. Related properties areScaleSpeed,TransformCenterSource,TransformCenter, andAccelerationTime. -
ScaleDown- Scales the view platform smaller so that the virtual world appears to grow larger. This action is not assigned by default.
ReadAction2Dsets the action bound to 2D valuator reads; that is, non-zero values generated by the device when no buttons have been pressed. If the value is (0.0, 0.0) or below the threshold value set byThreshold2D, then this behavior does nothing; otherwise, the following actions can be performed:-
Rotation- Rotates the view platform. This is the default 2D valuator action set by this behavior. Related properties areRotationSpeed,RotationCoords,TransformCenterSource, andTransformCenter. -
Translation- Translates the view platform. The translation occurs relative to the X and Z basis vectors of either the 6DOF sensor or the view platform if one is not available. The maximum speed is equal to the product of theTranslationSpeedandFastSpeedFactorproperty values. -
Scale- Scales the view platform smaller with positive Y values and larger with negative Y values. The effect is to increase the apparent size of the virtual world when pushing the valuator forwards and to decrease it when pushing backwards. Related properties areScaleSpeed,TransformCenterSource, andTransformCenter.
ButtonAction2Dsets an action for a specific button on the 2D valuator. The available actions are the same as forReadAction2D. No actions are bound by default to the 2D valuator buttons.The view transform may be reset to its home transform by pressing a number of buttons simultaneously on the 6DOF sensor. The minimum number of buttons that must be pressed is set by
ResetViewButtonCount6D. This value must be greater than one; the default is three. This action may be disabled by setting the property value to None. The corresponding property for the 2D valuator isResetViewButtonCount2D, with a default value of None. Note, however, that the reset view action will be ineffectual if an action which always modifies the view transform is bound to reads on the sensor used to reset the view, since the reset transform will get overwritten by the read action.The special value
Nonecan in general be assigned to any button or read action to prevent any defaults from being bound to it.- Since:
- Java 3D 1.3
- See Also:
ConfiguredUniverse,SensorEventAgent
-
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classWandViewBehavior.EchoReadListener6DImplements a 6DOF sensor read listener that updates the orientation and position of the sensor's echo in the virtual world.classWandViewBehavior.GrabViewListener6DImplements a 6DOF sensor button listener to directly manipulate the view platform transform.classWandViewBehavior.ListenerBaseA base class for implementing some of this behavior's listeners.classWandViewBehavior.ResetViewListenerResets the view back to the home transform when a specified number of buttons are down simultaneously.classWandViewBehavior.RotationListener2DImplements a 2D valuator listener that rotates the view platform.classWandViewBehavior.RotationListener6DImplements a 6DOF sensor button listener that rotates the view platform about a Y axis.classWandViewBehavior.ScaleListener2DImplements a 2D valuator listener that scales the view platform.classWandViewBehavior.ScaleListener6DImplements a 6DOF sensor button listener that scales the view platform.classWandViewBehavior.TranslationListener2DImplements a 2D valuator listener that translates the view platform.classWandViewBehavior.TranslationListener6DImplements a 6DOF sensor button listener that translates the view platform along the direction the sensor is pointing.
-
Field Summary
Fields Modifier and Type Field Description static intBEAMIndicates that the echo type is a beam extending from the origin of the sensor's local coordinate system to its hotspot.static intDEGREESIndicates that rotation speed should be in degrees.static intECHOIndicates that the 6DOF sensor read action should be bound to displaying the sensor's echo in the virtual world.static intGNOMONIndicates that the echo type is a gnomon displaying the directions of the sensor's local coordinate system axes at the location of the sensor's hotspot.static intGRAB_VIEWIndicates that a 6DOF sensor button action should be bound to grabbing the view.static intHEADIndicates that rotation should occur in head coordinates.static intHOTSPOTIndicates that rotation or scale should be about a 6DOF sensor hotspot.static intNONEIndicates a null configuration choice.static intPER_FRAMEIndicates that translation, rotation, or scaling speeds are per frame.static intPER_SECONDUse to indicate that translation, rotation, or scaling speeds are per second.static intPHYSICAL_METERSIndicates that translation speed is in physical world units (meters per second or per frame).static intRADIANSIndicates that rotation speed should be in radians.static intROTATE_CCWIndicates that a 6DOF sensor button action should be bound to rotate the view plaform counter-clockwise about a Y axis.static intROTATE_CWIndicates that a 6DOF sensor button action should be bound to rotate the view platform clockwise about a Y axis.static intROTATIONIndicates that a 2D sensor button or read action should be bound to rotation.static intSCALEIndicates that a 2D sensor button or read action should be bound to scaling.static intSCALE_DOWNIndicates that a 6DOF sensor button action should be bound to scaling the view platform smaller.static intSCALE_UPIndicates that a 6DOF sensor button action should be bound to scaling the view platform larger.static intSENSORIndicates that rotation should occur in sensor coordinates.static intTRANSLATE_BACKWARDIndicates that a 6DOF sensor button action should be bound to translating the view backward.static intTRANSLATE_FORWARDIndicates that a 6DOF sensor button action should be bound to translating the view forward.static intTRANSLATIONIndicates that a 2D sensor button or read action should be bound to translation.static intVIEW_PLATFORMIndicates that rotation should occur in view platform coordinates.static intVIRTUAL_UNITSIndicates that translation speed is in virtual world units.static intVWORLD_FIXEDIndicates that rotation or scale should be about a fixed point in virtual world coordinates.-
Fields inherited from class com.sun.j3d.utils.behaviors.vp.ViewPlatformBehavior
homeTransform, targetTG, vp
-
Fields inherited from class javax.media.j3d.Node
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_LOCALE_READ, ALLOW_PARENT_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
-
-
Constructor Summary
Constructors Constructor Description WandViewBehavior()Parameterless constructor for this behavior.WandViewBehavior(Sensor sensor6D, Sensor sensor2D, int echoType, double echoSize)Creates a new instance with the specified sensors and echo parameters.WandViewBehavior(Sensor sensor6D, Sensor sensor2D, TransformGroup echo)Creates a new instance with the specified sensors and a 6DOF sensor echo parented by the specifiedTransformGroup.WandViewBehavior(Sensor sensor6D, Sensor sensor2D, View view, TransformGroup viewTransform, Transform3D homeTransform, TransformGroup echo)Creates a new instance with the specified sensors and a 6DOF sensor echo parented by the specifiedTransformGroup.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidAccelerationTime(java.lang.Object[] time)Property which sets the time interval for accelerating to the translation, rotation, or scale speeds and for transitioning between the normal and fast translation speeds.voidButtonAction2D(java.lang.Object[] action)Property which sets a button action for the 2D valuator.voidButtonAction6D(java.lang.Object[] action)Property which sets a button action for the 6DOF sensor.protected voidconfigureEcho()Creates a 6DOF sensor echo according to configuration parameters.protected voidconfigureSensorActions()Creates the sensor listeners for a 6DOF sensor and/or a 2D valuator sensor using the predefined button and read listeners and the configured action bindings.voidConstantSpeedTime(java.lang.Object[] time)Property which sets the time interval for which the translation occurs at the normal speed.voidEchoColor(java.lang.Object[] color)Property which sets the color of the 6DOF sensor echo.voidEchoSize(java.lang.Object[] echoSize)Property which sets the size of the 6DOF sensor echo in physical meters.voidEchoTransparency(java.lang.Object[] transparency)Property which sets the 6DOF sensor echo transparency.voidEchoType(java.lang.Object[] type)Property which sets the 6DOF sensor echo type.voidFastSpeedFactor(java.lang.Object[] factor)Property which sets the fast translation speed factor.doublegetAccelerationTime()Gets the time interval for accelerating to normal speed and for transitioning between the normal and fast translation speeds.intgetButtonAction2D(int button)Gets the action associated with the specified button on the 2D valuator.intgetButtonAction6D(int button)Gets the action associated with the specified button on the 6DOF sensor.doublegetConstantSpeedTime()Gets the time interval for which the translation occurs at the normal speed.voidgetEchoColor(javax.vecmath.Color3f color)Gets the 6DOF sensor echo color.Shape3DgetEchoGeometry()Gets theShape3Ddefining the 6DOF sensor's echo geometry and appearance.doublegetEchoSize()Gets the size of the 6DOF sensor echo in meters.TransformGroupgetEchoTransformGroup()Gets the transform group containing a 6DOF sensor's echo geometry.floatgetEchoTransparency()Gets the 6DOF sensor echo transparency value.intgetEchoType()Gets the echo type.doublegetFastSpeedFactor()Gets the factor by which the normal translation speed is multiplied after the constant speed time interval.intgetMatrixXIndex2D()Gets the index where the X value of a 2D valuator read matrix can be found.intgetMatrixYIndex2D()Gets the index where the Y value of a 2D valuator read matrix can be found.voidgetNominalSensorRotation(Transform3D t3d)Gets the nominal sensor transform.intgetReadAction2D()Gets the configured 2D valuator read action.intgetReadAction6D()Gets the configured 6DOF sensor read action.intgetResetViewButtonCount2D()Gets the number of buttons to be pressed simultaneously on the 2D valuator in order to reset the view back to the home transform.intgetResetViewButtonCount6D()Gets the number of buttons to be pressed simultaneously on the 6DOF sensor in order to reset the view back to the home transform.intgetRotationCoords()Gets the rotation coordinate system.doublegetRotationSpeed()Gets the rotation speed.intgetRotationTimeBase()Gets the time base for rotation speed.intgetRotationUnits()Gets the rotation speed unitsdoublegetScaleSpeed()Gets the scaling speed.intgetScaleTimeBase()Gets the time base for scaling speed.SensorgetSensor2D()Returns a reference to the 2D valuator used for manipulating the view platform.SensorgetSensor6D()Returns a reference to the 6DOF sensor used for manipulating the view platform.SensorEventAgentgetSensorEventAgent()Gets theSensorEventAgentused by this behavior.doublegetThreshold2D()Gets the 2D valuator threshold.voidgetTransformCenter(javax.vecmath.Point3d center)Gets the rotation/scale center in virtual world coordinates.intgetTransformCenterSource()Gets the rotation/scale center source.doublegetTranslationSpeed()Gets the normal speed at which to translate the view platform.intgetTranslationTimeBase()Gets the time base for translation speed.intgetTranslationUnits()Gets the translation speed units.voidinitialize()Initializes and configures this behavior.voidMatrixIndices2D(java.lang.Object[] indices)Property which specifies where to find the X and Y values in the matrix read generated by a 2D valuator.voidNominalSensorRotation(java.lang.Object[] matrix)Property which sets the nominal sensor rotation.voidprocessStimulus(java.util.Enumeration criteria)Processes a stimulus meant for this behavior.voidReadAction2D(java.lang.Object[] action)Property which sets the action to be bound to 2D valuator reads.voidReadAction6D(java.lang.Object[] action)Property which sets the action to be bound to 6DOF sensor reads.voidResetViewButtonCount2D(java.lang.Object[] count)Property which sets the number of buttons to be pressed simultaneously on the 2D valuator in order to reset the view back to the home transform.voidResetViewButtonCount6D(java.lang.Object[] count)Property which sets the number of buttons to be pressed simultaneously on the 6DOF sensor in order to reset the view back to the home transform.voidRotationCoords(java.lang.Object[] coords)Property which sets the rotation coordinate system.voidRotationSpeed(java.lang.Object[] speed)Property which sets the rotation speed.voidScaleSpeed(java.lang.Object[] speed)Property which sets the scaling speed.voidSensor2D(java.lang.Object[] sensor)Property which sets a 2D sensor for manipulating the view platform.voidSensor6D(java.lang.Object[] sensor)Property which sets a 6DOF sensor for manipulating the view platform.voidsetAccelerationTime(double time)Sets the time interval for accelerating to the translation, rotation, or scale speeds and for transitioning between the normal and fast translation speeds.voidsetButtonAction2D(int button, int action)Sets a button action for the 2D valuator.voidsetButtonAction6D(int button, int action)Sets a button action for the 6DOF sensor.voidsetConstantSpeedTime(double time)Sets the time interval for which the translation occurs at the normal speed.voidsetEchoColor(javax.vecmath.Color3f color)Sets the color of the 6DOF sensor echo.voidsetEchoSize(double echoSize)Sets the size of the 6DOF sensor echo in physical meters.voidsetEchoTransformGroup(TransformGroup echo)Sets the transform group containing a 6DOF sensor's echo geometry.voidsetEchoTransparency(float transparency)Sets the 6DOF sensor echo transparency.voidsetEchoType(int type)Sets the 6DOF sensor echo type.voidsetEnable(boolean enable)Enables or disables this behavior.voidsetFastSpeedFactor(double factor)Sets the fast translation speed factor.voidsetMatrixIndices2D(int xIndex, int yIndex)Specifies where to find the X and Y values in the matrix read generated by a 2D valuator.voidsetNominalSensorRotation(Transform3D transform)Sets the nominal sensor transform.voidsetReadAction2D(int action)Sets the action to be bound to 2D valuator reads.voidsetReadAction6D(int action)Sets the action to be bound to 6DOF sensor reads.voidsetResetViewButtonCount2D(int count)Sets the number of buttons to be pressed simultaneously on the 2D valuator in order to reset the view back to the home transform.voidsetResetViewButtonCount6D(int count)Sets the number of buttons to be pressed simultaneously on the 6DOF sensor in order to reset the view back to the home transform.voidsetRotationCoords(int coords)Sets the rotation coordinate system.voidsetRotationSpeed(double speed, int units, int timeBase)Sets the rotation speed.voidsetScaleSpeed(double speed, int timeBase)Sets the scaling speed.voidsetThreshold2D(double threshold)Sets the threshold for 2D valuator reads.voidsetTransformCenter(javax.vecmath.Point3d center)Sets the center of rotation and scale ifsetTransformCenterSourceis called withVWORLD_FIXEDor if a 6DOF sensor is not specified.voidsetTransformCenterSource(int source)Sets the source of the center of rotation and scale.voidsetTranslationSpeed(double speed, int units, int timeBase)Sets the normal translation speed.voidsetViewingPlatform(ViewingPlatform vp)Sets theViewingPlatformfor this behavior.voidThreshold2D(java.lang.Object[] threshold)Property which sets the threshold for 2D valuator reads.voidTransformCenter(java.lang.Object[] center)Property which sets the center of rotation and scale if theTransformCenterSourceproperty isVworldFixedor if a 6DOF sensor is not specified.voidTransformCenterSource(java.lang.Object[] source)Property which sets the source of the center of rotation and scale.voidTranslationSpeed(java.lang.Object[] speed)Property which sets the normal translation speed.protected voidupdateEcho(Sensor sensor, Transform3D sensorToVworld)Updates the echo position and orientation.-
Methods inherited from class com.sun.j3d.utils.behaviors.vp.ViewPlatformBehavior
getHomeTransform, getViewingPlatform, goHome, setHomeTransform
-
Methods inherited from class javax.media.j3d.Behavior
getEnable, getNumSchedulingIntervals, getSchedulingBoundingLeaf, getSchedulingBounds, getSchedulingInterval, getView, getWakeupCondition, postId, setSchedulingBoundingLeaf, setSchedulingBounds, setSchedulingInterval, updateNodeReferences, wakeupOn
-
Methods inherited from class javax.media.j3d.Node
cloneNode, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, duplicateNode, getBounds, getBoundsAutoCompute, getCollidable, getLocale, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
-
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString
-
-
-
-
Field Detail
-
NONE
public static final int NONE
Indicates a null configuration choice.- See Also:
- Constant Field Values
-
GRAB_VIEW
public static final int GRAB_VIEW
Indicates that a 6DOF sensor button action should be bound to grabbing the view. The default is button 0.- See Also:
- Constant Field Values
-
TRANSLATE_FORWARD
public static final int TRANSLATE_FORWARD
Indicates that a 6DOF sensor button action should be bound to translating the view forward. The default is button 1.- See Also:
- Constant Field Values
-
TRANSLATE_BACKWARD
public static final int TRANSLATE_BACKWARD
Indicates that a 6DOF sensor button action should be bound to translating the view backward. The default is button 2.- See Also:
- Constant Field Values
-
ROTATE_CCW
public static final int ROTATE_CCW
Indicates that a 6DOF sensor button action should be bound to rotate the view plaform counter-clockwise about a Y axis.- See Also:
- Constant Field Values
-
ROTATE_CW
public static final int ROTATE_CW
Indicates that a 6DOF sensor button action should be bound to rotate the view platform clockwise about a Y axis.- See Also:
- Constant Field Values
-
SCALE_UP
public static final int SCALE_UP
Indicates that a 6DOF sensor button action should be bound to scaling the view platform larger.- See Also:
- Constant Field Values
-
SCALE_DOWN
public static final int SCALE_DOWN
Indicates that a 6DOF sensor button action should be bound to scaling the view platform smaller.- See Also:
- Constant Field Values
-
TRANSLATION
public static final int TRANSLATION
Indicates that a 2D sensor button or read action should be bound to translation.- See Also:
- Constant Field Values
-
SCALE
public static final int SCALE
Indicates that a 2D sensor button or read action should be bound to scaling.- See Also:
- Constant Field Values
-
ROTATION
public static final int ROTATION
Indicates that a 2D sensor button or read action should be bound to rotation. The default is to bind rotation to the 2D sensor reads.- See Also:
- Constant Field Values
-
PER_FRAME
public static final int PER_FRAME
Indicates that translation, rotation, or scaling speeds are per frame.- See Also:
- Constant Field Values
-
PER_SECOND
public static final int PER_SECOND
Use to indicate that translation, rotation, or scaling speeds are per second. This is the default.- See Also:
- Constant Field Values
-
VIRTUAL_UNITS
public static final int VIRTUAL_UNITS
Indicates that translation speed is in virtual world units.- See Also:
- Constant Field Values
-
PHYSICAL_METERS
public static final int PHYSICAL_METERS
Indicates that translation speed is in physical world units (meters per second or per frame). This is the default.- See Also:
- Constant Field Values
-
RADIANS
public static final int RADIANS
Indicates that rotation speed should be in radians.- See Also:
- Constant Field Values
-
DEGREES
public static final int DEGREES
Indicates that rotation speed should be in degrees. This is the default.- See Also:
- Constant Field Values
-
VIEW_PLATFORM
public static final int VIEW_PLATFORM
Indicates that rotation should occur in view platform coordinates.- See Also:
- Constant Field Values
-
HEAD
public static final int HEAD
Indicates that rotation should occur in head coordinates.- See Also:
- Constant Field Values
-
SENSOR
public static final int SENSOR
Indicates that rotation should occur in sensor coordinates. This is the default.- See Also:
- Constant Field Values
-
VWORLD_FIXED
public static final int VWORLD_FIXED
Indicates that rotation or scale should be about a fixed point in virtual world coordinates.- See Also:
- Constant Field Values
-
HOTSPOT
public static final int HOTSPOT
Indicates that rotation or scale should be about a 6DOF sensor hotspot. This is the default.- See Also:
- Constant Field Values
-
ECHO
public static final int ECHO
Indicates that the 6DOF sensor read action should be bound to displaying the sensor's echo in the virtual world. This is the default.- See Also:
- Constant Field Values
-
GNOMON
public static final int GNOMON
Indicates that the echo type is a gnomon displaying the directions of the sensor's local coordinate system axes at the location of the sensor's hotspot.- See Also:
- Constant Field Values
-
BEAM
public static final int BEAM
Indicates that the echo type is a beam extending from the origin of the sensor's local coordinate system to its hotspot.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WandViewBehavior
public WandViewBehavior()
Parameterless constructor for this behavior. This is called when this behavior is instantiated from a configuration file.Syntax:
(NewViewPlatformBehavior <name> com.sun.j3d.utils.behaviors.vp.WandViewBehavior)
-
WandViewBehavior
public WandViewBehavior(Sensor sensor6D, Sensor sensor2D, int echoType, double echoSize)
Creates a new instance with the specified sensors and echo parameters. At least one sensor must be non-null.This constructor should only be used if either
SimpleUniverseorConfiguredUniverseis used to set up the view side of the scene graph, or if it is otherwise to be attached to aViewingPlatform. If this behavior is not instantiated from a configuration file then it must then be explicitly attached to aViewingPlatforminstance with theViewingPlatform.setViewPlatformBehaviormethod.- Parameters:
sensor6D- a six degree of freedom sensor which generates reads relative to the tracker base in physical units; may benullsensor2D- 2D valuator which generates X and Y reads ranging from [-1.0 .. +1.0]; may benullechoType- eitherGNOMON,BEAM, orNONEfor the 6DOF sensor echoechoSize- the width of the 6DOF sensor echo in physical meters; ignored if echoType isNONE
-
WandViewBehavior
public WandViewBehavior(Sensor sensor6D, Sensor sensor2D, TransformGroup echo)
Creates a new instance with the specified sensors and a 6DOF sensor echo parented by the specifiedTransformGroup. At least one sensor must be non-null.This constructor should only be used if either
SimpleUniverseorConfiguredUniverseis used to set up the view side of the scene graph, or if it is otherwise to be attached to aViewingPlatform. If this behavior is not instantiated from a configuration file then it must then be explicitly attached to aViewingPlatforminstance with theViewingPlatform.setViewPlatformBehaviormethod.If the echo
TransformGroupis non-null, it will be added to a newBranchGroupand attached to theViewingPlatform, where its transform will be updated in response to the sensor reads. Capabilities to allow writing its transform and to read, write, and extend its children will be set. The echo geometry is assumed to incorporate the position and orientation of the 6DOF sensor hotspot.- Parameters:
sensor6D- a six degree of freedom sensor which generates reads relative to the tracker base in physical units; may benullsensor2D- 2D valuator which generates X and Y reads ranging from [-1.0 .. +1.0]; may benullecho- aTransformGroupcontaining the visible echo which will track the 6DOF sensor's position and orientation, ornullfor no echo
-
WandViewBehavior
public WandViewBehavior(Sensor sensor6D, Sensor sensor2D, View view, TransformGroup viewTransform, Transform3D homeTransform, TransformGroup echo)
Creates a new instance with the specified sensors and a 6DOF sensor echo parented by the specifiedTransformGroup. At least one sensor must be non-null.This constructor should only be used if
SimpleUniverseorConfiguredUniverseis not used to set up the view side of the scene graph. The application must set up the view side itself and supply references to theViewand theTransformGroupcontaining the view platform transform.ViewingPlatform.setViewPlatformBehaviormust not be called, and this behavior must be explicitly added to the virtual universe by the application.If the echo
TransformGroupis non-null, it will only be used to update its associated transform with the position and orientation of a 6DOF sensor (if supplied). The application is responsible for adding the echo to the virtual universe. The echo geometry is assumed to incorporate the position and orientation of the 6DOF sensor hotspot.- Parameters:
sensor6D- a six degree of freedom sensor which generates reads relative to the tracker base in physical units; may benullsensor2D- 2D valuator which generates X and Y reads ranging from [-1.0 .. +1.0]; may benullview- a reference to theViewattached to theViewPlatformto be manipulated by this behaviorviewTransform- aTransformGroupcontaining the view platform transform; appropriate capabilities to update the transform must be sethomeTransform- aTransform3Dcontaining the view transform to be used when the view is reset; may benullfor identityecho- aTransformGroupcontaining the visible echo which will track the 6DOF sensor's position and orientation, ornullfor no echo; appropriate capabilities to update the transform must be set
-
-
Method Detail
-
initialize
public void initialize()
Initializes and configures this behavior. NOTE: Applications should not call this method. It is called by the Java 3D behavior scheduler.- Specified by:
initializein classBehavior
-
processStimulus
public void processStimulus(java.util.Enumeration criteria)
Processes a stimulus meant for this behavior. NOTE: Applications should not call this method. It is called by the Java 3D behavior scheduler.- Specified by:
processStimulusin classBehavior- Parameters:
criteria- an enumeration of triggered wakeup criteria for this behavior
-
setEnable
public void setEnable(boolean enable)
Enables or disables this behavior. The default state is enabled.
-
setViewingPlatform
public void setViewingPlatform(ViewingPlatform vp)
Sets theViewingPlatformfor this behavior. If a subclass overrides this method, it must callsuper.setViewingPlatform(vp). NOTE: Applications should not call this method. It is called by theViewingPlatform.- Overrides:
setViewingPlatformin classViewPlatformBehavior- Parameters:
vp- the target ViewingPlatform for this behavior
-
configureSensorActions
protected void configureSensorActions()
Creates the sensor listeners for a 6DOF sensor and/or a 2D valuator sensor using the predefined button and read listeners and the configured action bindings.This is invoked the first time
initializeis called. This method can be overridden by subclasses to modify the configured bindings or introduce other configuration parameters.
-
configureEcho
protected void configureEcho()
Creates a 6DOF sensor echo according to configuration parameters. This is done only if a 6DOF sensor has been specified, the 6DOF sensor read action has been set to echo the sensor position, the echo transform group has not already been set, and a ViewingPlatform is in use. This is invoked the first timeinitializeis called to set this behavior live, but before the echo transform group is added to aBranchGroupand made live. This method can be overridden to support other echo geometry.
-
updateEcho
protected void updateEcho(Sensor sensor, Transform3D sensorToVworld)
Updates the echo position and orientation. The echo is placed at the sensor hotspot position if applicable. This implementation assumes the hotspot position and orientation have been incorporated into the echo geometry.- Parameters:
sensor- the sensor to be echoedsensorToVworld- transform from sensor coordinates to virtual world coordinates- See Also:
setEchoType(int),setEchoSize(double),setReadAction6D(int),SensorGnomonEcho,SensorBeamEcho
-
Sensor6D
public void Sensor6D(java.lang.Object[] sensor)
Property which sets a 6DOF sensor for manipulating the view platform. This sensor must generate 6 degree of freedom orientation and position data in physical meters relative to the sensor's tracker base.This property is set in the configuration file. The first command form assumes that a
ViewingPlatformis being used and that the sensor name can be looked up from aConfiguredUniversereference retrieved fromViewingPlatform.getUniverse. The second form is preferred and accepts the Sensor reference directly.Syntax:
(ViewPlatformBehaviorProperty <name> Sensor6D <sensorName>)Alternative Syntax:
(ViewPlatformBehaviorProperty <name> Sensor6D (Sensor <sensorName>))- Parameters:
sensor- array of length 1 containing aStringor aSensor
-
getSensor6D
public Sensor getSensor6D()
Returns a reference to the 6DOF sensor used for manipulating the view platform.- Returns:
- the 6DOF sensor
-
Sensor2D
public void Sensor2D(java.lang.Object[] sensor)
Property which sets a 2D sensor for manipulating the view platform. This is intended to support devices which incorporate a separate 2D valuator along with the 6DOF sensor. The X and Y values from the valuator should have a continuous range from -1.0 to +1.0, although rotation, translation, and scaling speeds can be scaled to compensate for a different range. The X and Y values are found in the sensor's read matrix at the indices specified by theMatrixIndices2Dproperty, with defaults of 3 and 7 (the X and Y translation components) respectively.This property is set in the configuration file. The first command form assumes that a
ViewingPlatformis being used and that the sensor name can be looked up from aConfiguredUniversereference retrieved fromViewingPlatform.getUniverse. The second form is preferred and accepts the Sensor reference directly.Syntax:
(ViewPlatformBehaviorProperty <name> Sensor2D <sensorName>)Alternative Syntax:
(ViewPlatformBehaviorProperty <name> Sensor2D (Sensor <sensorName>))- Parameters:
sensor- array of length 1 containing aStringor aSensor
-
getSensor2D
public Sensor getSensor2D()
Returns a reference to the 2D valuator used for manipulating the view platform.- Returns:
- the 2D valuator
-
ButtonAction6D
public void ButtonAction6D(java.lang.Object[] action)
Property which sets a button action for the 6DOF sensor. The choices areTranslateForward,TranslateBackward,GrabView,RotateCCW,RotateCW,ScaleUp,ScaleDown, orNone. By default, button 0 is bound toGrabView, button 1 is bound toTranslateForward, and button 2 is bound toTranslateBackward. If there are fewer than three buttons available, then the default button actions with the lower button indices have precedence. A value ofNoneindicates that no default action is to be associated with the specified button.TranslateForwardmoves the view platform forward along the direction the sensor is pointing.TranslateBackwarddoes the same, in the opposite direction.GrabViewdirectly manipulates the view by moving it in inverse response to the sensor's position and orientation.RotateCCWandRotateCWrotate about a Y axis, whileScaleUpandScaleDownscale the view platform larger and smaller.Specifying a button index that is greater than that available with the 6DOF sensor will result in an
ArrayOutOfBoundsExceptionwhen the behavior is initialized or attached to aViewingPlatform.This property is set in the configuration file read by
ConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> ButtonAction6D <button index> [GrabView | TranslateForward | TranslateBackward | RotateCCW | RotateCW | ScaleUp | ScaleDown | None])- Parameters:
action- array of length 2 containing aDoubleand aString.- See Also:
setButtonAction6D(int, int),Sensor6D,TranslationSpeed,AccelerationTime,ConstantSpeedTime,FastSpeedFactor,RotationSpeed,RotationCoords,ScaleSpeed,TransformCenterSource,TransformCenter,WandViewBehavior.GrabViewListener6D,WandViewBehavior.TranslationListener6D,WandViewBehavior.RotationListener6D,WandViewBehavior.ScaleListener6D
-
setButtonAction6D
public void setButtonAction6D(int button, int action)Sets a button action for the 6DOF sensor. The choices areTRANSLATE_FORWARD,TRANSLATE_BACKWARD,GRAB_VIEW,ROTATE_CCW,ROTATE_CW,SCALE_UP,SCALE_DOWN, orNONE. By default, button 0 is bound toGRAB_VIEW, button 1 is bound toTRANSLATE_FORWARD, and button 2 is bound toTRANSLATE_BACKWARD. If there are fewer than three buttons available, then the default button actions with the lower button indices have precedence. A value ofNONEindicates that no default action is to be associated with the specified button.TRANSLATE_FORWARDmoves the view platform forward along the direction the sensor is pointing.TRANSLATE_BACKWARDdoes the same, in the opposite direction.GRAB_VIEWdirectly manipulates the view by moving it in inverse response to the sensor's position and orientation.ROTATE_CCWandROTATE_CWrotate about a Y axis, whileSCALE_UPandSCALE_DOWNscale the view platform larger and smaller.Specifying a button index that is greater that that available with the 6DOF sensor will result in an
ArrayOutOfBoundsExceptionwhen the behavior is initialized or attached to aViewingPlatform.This method only configures the button listeners pre-defined by this behavior. For complete control over the button actions, access the
SensorEventAgentused by this behavior directly.- Parameters:
button- index of the button to bindaction- eitherTRANSLATE_FORWARD,TRANSLATE_BACKWARD,GRAB_VIEW,ROTATE_CCW,ROTATE_CW,,SCALE_UPSCALE_DOWN, orNONE- See Also:
setTranslationSpeed(double, int, int),setAccelerationTime(double),setConstantSpeedTime(double),setFastSpeedFactor(double),setRotationSpeed(double, int, int),setRotationCoords(int),setScaleSpeed(double, int),setTransformCenterSource(int),setTransformCenter(javax.vecmath.Point3d),getSensorEventAgent(),WandViewBehavior.GrabViewListener6D,WandViewBehavior.TranslationListener6D,WandViewBehavior.RotationListener6D,WandViewBehavior.ScaleListener6D
-
getButtonAction6D
public int getButtonAction6D(int button)
Gets the action associated with the specified button on the 6DOF sensor.- Returns:
- the action associated with the button
-
ReadAction2D
public void ReadAction2D(java.lang.Object[] action)
Property which sets the action to be bound to 2D valuator reads. This action will be performed on each frame whenever no button actions have been invoked and the valuator read value is greater than the threshold range specified by theThreshold2Dproperty.The X and Y values from the valuator should have a continuous range from -1.0 to +1.0, although speeds can be scaled to compensate for a different range. The X and Y values are found in the sensor's read matrix at the indices specified by
MatrixIndices2D, with defaults of 3 and 7 respectively.The default property value of
Rotationrotates the view platform in the direction the valuator is pushed. The rotation coordinate system is set by theRotationCoordsproperty, with a default ofSensor. The rotation occurs about a point in the virtual world set by theTransformCenterSourceandTransformCenterproperties, with the default set to rotate about the hotspot of a 6DOF sensor, if one is available, or about the origin of the virtual world if not. The rotation speed is scaled by the valuator read value up to the maximum speed set with theRotationSpeedproperty; the default is 180 degrees per second.A property value of
Translationmoves the view platform in the direction the valuator is pushed. The translation occurs along the X and Z basis vectors of either a 6DOF sensor or the view platform if a 6DOF sensor is not specified. The translation speed is scaled by the valuator read value up to a maximum set by the product of theTranslationSpeedandFastSpeedFactorproperty values.If this property value is to
Scale, then the view platform is scaled smaller or larger when the valuator is pushed forward or backward. The scaling occurs about a point in the virtual world set by theTransformCenterSourceandTransformCenterproperties. The scaling speed is set with theScaleSpeedproperty, with a default scale factor of 2.0 per second at the extreme negative range of -1.0, and a factor of 0.5 per second at the extreme positive range of +1.0.A value of
NonepreventsRotationfrom being bound to the 2D valuator reads.This property is set in the configuration file read by
ConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> ReadAction2D [Rotation | Translation | Scale | None])- Parameters:
action- array of length 1 containing aString- See Also:
setReadAction2D(int),RotationCoords,RotationSpeed,TransformCenterSource,TransformCenter,TranslationSpeed,FastSpeedFactor,ScaleSpeed,MatrixIndices2D,WandViewBehavior.RotationListener2D,WandViewBehavior.TranslationListener2D,WandViewBehavior.ScaleListener2D
-
setReadAction2D
public void setReadAction2D(int action)
Sets the action to be bound to 2D valuator reads. This action will be performed on each frame whenever no button actions have been invoked and the valuator read value is greater than the threshold range specified bysetThreshold2D.The X and Y values from the valuator should have a continuous range from -1.0 to +1.0, although speeds can be scaled to compensate for a different range. The X and Y values are found in the sensor's read matrix at the indices specified by the
setMatrixIndices2Dmethod, with defaults of 3 and 7 respectively.The default action of
ROTATIONrotates the view platform in the direction the valuator is pushed. The rotation coordinate system is set bysetRotationCoords, with a default ofSENSOR. The rotation occurs about a point in the virtual world set bysetTransformCenterSourceandsetTransformCenter, with the default set to rotate about the hotspot of a 6DOF sensor, if one is available, or about the origin of the virtual world if not. The rotation speed is scaled by the valuator read value up to the maximum speed set withsetRotationSpeed; the default is 180 degrees per second.A value of
TRANSLATIONmoves the view platform in the direction the valuator is pushed. The translation occurs along the X and Z basis vectors of either a 6DOF sensor or the view platform if a 6DOF sensor is not specified. The translation speed is scaled by the valuator read value up to a maximum set by the product of thesetTranslationSpeedandsetFastSpeedFactorvalues.If the value is to
SCALE, then the view platform is scaled smaller or larger when the valuator is pushed forward or backward. The scaling occurs about a point in the virtual world set bysetTransformCenterSourceandsetTransformCenter. The scaling speed is set withsetScaleSpeed, with a default scale factor of 2.0 per second at the extreme negative range of -1.0, and a factor of 0.5 per second at the extreme positive range of +1.0.A value of
NONEpreventsROTATIONfrom being bound by default to the 2D valuator reads.This method only configures the read listeners pre-defined by this behavior. For complete control over the read actions, access the
SensorEventAgentused by this behavior directly.- Parameters:
action- eitherROTATION,TRANSLATION,SCALE, orNONE- See Also:
setRotationCoords(int),setRotationSpeed(double, int, int),setTransformCenterSource(int),setTransformCenter(javax.vecmath.Point3d),setTranslationSpeed(double, int, int),setFastSpeedFactor(double),setScaleSpeed(double, int),setMatrixIndices2D(int, int),getSensorEventAgent(),WandViewBehavior.RotationListener2D,WandViewBehavior.TranslationListener2D,WandViewBehavior.ScaleListener2D
-
getReadAction2D
public int getReadAction2D()
Gets the configured 2D valuator read action.- Returns:
- the action associated with the sensor read
-
ButtonAction2D
public void ButtonAction2D(java.lang.Object[] action)
Property which sets a button action for the 2D valuator. The possible values areRotation,Translation,Scale, orNone, with a default ofNone. These actions are the same as those forReadAction2D.Specifying a button index that is greater that that available with the 2D valuator will result in an
ArrayOutOfBoundsExceptionwhen the behavior is initialized or attached to aViewingPlatform.This property is set in the configuration file read by
ConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> ButtonAction2D <button index> [Rotation | Translation | Scale | None])- Parameters:
action- array of length 2 containing aDoubleand aString.- See Also:
setButtonAction2D(int, int),ReadAction2D,RotationCoords,RotationSpeed,TransformCenterSource,TransformCenter,TranslationSpeed,FastSpeedFactor,ScaleSpeed,MatrixIndices2D,WandViewBehavior.RotationListener2D,WandViewBehavior.TranslationListener2D,WandViewBehavior.ScaleListener2D
-
setButtonAction2D
public void setButtonAction2D(int button, int action)Sets a button action for the 2D valuator. The possible values areROTATION,TRANSLATION,SCALE, orNONE, with a default ofNONE. These actions are the same as those forsetReadAction2D.Specifying a button index that is greater that that available with the 2D valuator will result in an
ArrayOutOfBoundsExceptionwhen the behavior is initialized or attached to aViewingPlatform.This method only configures the button listeners pre-defined by this behavior. For complete control over the button actions, access the
SensorEventAgentused by this behavior directly.- Parameters:
button- index of the button to bindaction- eitherROTATION,TRANSLATION,SCALE, orNONE- See Also:
setReadAction2D(int),setRotationCoords(int),setRotationSpeed(double, int, int),setTransformCenterSource(int),setTransformCenter(javax.vecmath.Point3d),setTranslationSpeed(double, int, int),setFastSpeedFactor(double),setScaleSpeed(double, int),setMatrixIndices2D(int, int),getSensorEventAgent(),WandViewBehavior.RotationListener2D,WandViewBehavior.TranslationListener2D,WandViewBehavior.ScaleListener2D
-
getButtonAction2D
public int getButtonAction2D(int button)
Gets the action associated with the specified button on the 2D valuator.- Returns:
- the action associated with the button
-
ReadAction6D
public void ReadAction6D(java.lang.Object[] action)
Property which sets the action to be bound to 6DOF sensor reads. This action will be performed every frame whenever a button action has not been invoked.The default is
Echo, which displays a geometric representation of the sensor's current position and orientation in the virtual world. A value ofNoneindicates that no default action is to be applied to the sensor's read.This property is set in the configuration file read by
ConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> ReadAction6D [Echo | None])- Parameters:
action- array of length 1 containing aString- See Also:
setReadAction6D(int),WandViewBehavior.EchoReadListener6D
-
setReadAction6D
public void setReadAction6D(int action)
Sets the action to be bound to 6DOF sensor reads. This action will be performed every frame whenever a button action has not been invoked.The default is
ECHO, which displays a geometric representation of the sensor's current position and orientation in the virtual world. A value ofNONEindicates that no default action is to be associated with the sensor's read.This method only configures the read listeners pre-defined by this behavior. For complete control over the read actions, access the
SensorEventAgentused by this behavior directly.- Parameters:
action- eitherECHOorNONE- See Also:
WandViewBehavior.EchoReadListener6D,getSensorEventAgent()
-
getReadAction6D
public int getReadAction6D()
Gets the configured 6DOF sensor read action.- Returns:
- the configured 6DOF sensor read action
-
TranslationSpeed
public void TranslationSpeed(java.lang.Object[] speed)
Property which sets the normal translation speed. The default is 0.1 meters/second in physical units. This property is set in the configuration file read byConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> TranslationSpeed <speed> [PhysicalMeters | VirtualUnits] [PerFrame | PerSecond])- Parameters:
speed- array of length 3; first element is aDoublefor the speed, the second is aStringfor the units, and the third is aStringfor the time base- See Also:
setTranslationSpeed(double, int, int)
-
setTranslationSpeed
public void setTranslationSpeed(double speed, int units, int timeBase)Sets the normal translation speed. The default is 0.1 physical meters/second.- Parameters:
speed- how fast to translateunits- eitherPHYSICAL_METERSorVIRTUAL_UNITStimeBase- eitherPER_SECONDorPER_FRAME
-
getTranslationSpeed
public double getTranslationSpeed()
Gets the normal speed at which to translate the view platform.- Returns:
- the normal translation speed
-
getTranslationUnits
public int getTranslationUnits()
Gets the translation speed units.- Returns:
- the translation units
-
getTranslationTimeBase
public int getTranslationTimeBase()
Gets the time base for translation speed.- Returns:
- the translation time base
-
AccelerationTime
public void AccelerationTime(java.lang.Object[] time)
Property which sets the time interval for accelerating to the translation, rotation, or scale speeds and for transitioning between the normal and fast translation speeds. The default is 1 second. This property is set in the configuration file read byConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> AccelerationTime <seconds>)- Parameters:
time- array of length 1 containing aDouble- See Also:
setAccelerationTime(double)
-
setAccelerationTime
public void setAccelerationTime(double time)
Sets the time interval for accelerating to the translation, rotation, or scale speeds and for transitioning between the normal and fast translation speeds. The default is 1 second.- Parameters:
time- number of seconds to accelerate to normal or fast speed
-
getAccelerationTime
public double getAccelerationTime()
Gets the time interval for accelerating to normal speed and for transitioning between the normal and fast translation speeds.- Returns:
- the acceleration time
-
ConstantSpeedTime
public void ConstantSpeedTime(java.lang.Object[] time)
Property which sets the time interval for which the translation occurs at the normal speed. The default is 8 seconds. This property is set in the configuration file read byConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> ConstantSpeedTime <seconds>)- Parameters:
time- array of length 1 containing aDouble- See Also:
setConstantSpeedTime(double)
-
setConstantSpeedTime
public void setConstantSpeedTime(double time)
Sets the time interval for which the translation occurs at the normal speed. The default is 8 seconds.- Parameters:
time- number of seconds to translate at a constant speed
-
getConstantSpeedTime
public double getConstantSpeedTime()
Gets the time interval for which the translation occurs at the normal speed.- Returns:
- the constant speed time
-
FastSpeedFactor
public void FastSpeedFactor(java.lang.Object[] factor)
Property which sets the fast translation speed factor. The default is 10 times the normal speed. This property is set in the configuration file read by ConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> FastSpeedFactor <factor>)- Parameters:
factor- array of length 1 containing aDouble- See Also:
setFastSpeedFactor(double)
-
setFastSpeedFactor
public void setFastSpeedFactor(double factor)
Sets the fast translation speed factor. The default is 10 times the normal speed.- Parameters:
factor- scale by which the normal translation speed is multiplied
-
getFastSpeedFactor
public double getFastSpeedFactor()
Gets the factor by which the normal translation speed is multiplied after the constant speed time interval.- Returns:
- the fast speed factor
-
Threshold2D
public void Threshold2D(java.lang.Object[] threshold)
Property which sets the threshold for 2D valuator reads. The default is 0.0. It can be set higher to handle noisy valuators. This property is set in the configuration file read byConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> Threshold2D <threshold>)- Parameters:
threshold- array of length 1 containing aDouble- See Also:
setThreshold2D(double)
-
setThreshold2D
public void setThreshold2D(double threshold)
Sets the threshold for 2D valuator reads. The default is 0.0. It can be set higher to handle noisy valuators.- Parameters:
threshold- if the absolute values of both the X and Y valuator reads are less than this value then the values are ignored
-
getThreshold2D
public double getThreshold2D()
Gets the 2D valuator threshold.- Returns:
- the threshold value
-
MatrixIndices2D
public void MatrixIndices2D(java.lang.Object[] indices)
Property which specifies where to find the X and Y values in the matrix read generated by a 2D valuator. The defaults are along the translation components of the matrix, at indices 3 and 7. This property is set in the configuration file read byConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> MatrixIndices2D <X index> <Y index>)- Parameters:
indices- array of length 2 containingDoubles- See Also:
setMatrixIndices2D(int, int)
-
setMatrixIndices2D
public void setMatrixIndices2D(int xIndex, int yIndex)Specifies where to find the X and Y values in the matrix read generated by a 2D valuator. The defaults are along the translation components of the matrix, at indices 3 and 7.- Parameters:
xIndex- index of the X valuator valueyIndex- index of the Y valuator value
-
getMatrixXIndex2D
public int getMatrixXIndex2D()
Gets the index where the X value of a 2D valuator read matrix can be found.- Returns:
- the X index in the read matrix
-
getMatrixYIndex2D
public int getMatrixYIndex2D()
Gets the index where the Y value of a 2D valuator read matrix can be found.- Returns:
- the Y index in the read matrix
-
RotationSpeed
public void RotationSpeed(java.lang.Object[] speed)
Property which sets the rotation speed. The default is 180 degrees/second. This property is set in the configuration file read byConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> RotationSpeed <speed> [Degrees | Radians] [PerFrame | PerSecond])- Parameters:
speed- array of length 3; first element is aDoublefor the speed, the second is aStringfor the units, and the third is aStringfor the time base- See Also:
setRotationSpeed(double, int, int)
-
setRotationSpeed
public void setRotationSpeed(double speed, int units, int timeBase)Sets the rotation speed. The default is 180 degrees/second.- Parameters:
speed- how fast to rotateunits- eitherDEGREESorRADIANStimeBase- eitherPER_SECONDorPER_FRAME
-
getRotationSpeed
public double getRotationSpeed()
Gets the rotation speed.- Returns:
- the rotation speed
-
getRotationUnits
public int getRotationUnits()
Gets the rotation speed units- Returns:
- the rotation units
-
getRotationTimeBase
public int getRotationTimeBase()
Gets the time base for rotation speed.- Returns:
- the rotation time base
-
RotationCoords
public void RotationCoords(java.lang.Object[] coords)
Property which sets the rotation coordinate system. The default isSensor, which means that the rotation axis is parallel to the XY plane of the current orientation of a specified 6DOF sensor. A value ofViewPlatformmeans the rotation axis is parallel to the XY plane of the view platform. The latter is also the fallback if a 6DOF sensor is not specified. If the value isHead, then the rotation occurs in head coordinates.This property is set in the configuration file read by
ConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> RotationCoords [Sensor | ViewPlatform | Head])- Parameters:
coords- array of length 1 containing aString- See Also:
setRotationCoords(int)
-
setRotationCoords
public void setRotationCoords(int coords)
Sets the rotation coordinate system. The default isSENSOR, which means that the rotation axis is parallel to the XY plane of the current orientation of a specified 6DOF sensor. A value ofVIEW_PLATFORMmeans the rotation axis is parallel to the XY plane of the view platform. The latter is also the fallback if a 6DOF sensor is not specified. If the value isHEAD, then rotation occurs in head coordinates.- Parameters:
coords- eitherSENSOR,VIEW_PLATFORM, orHEAD
-
getRotationCoords
public int getRotationCoords()
Gets the rotation coordinate system.- Returns:
- the rotation coordinate system
-
ScaleSpeed
public void ScaleSpeed(java.lang.Object[] speed)
Property which sets the scaling speed. The default is 2.0 per second, which means magnification doubles the apparent size of the virtual world every second, and minification halves the apparent size of the virtual world every second.The scaling applied with each frame is
Math.pow(scaleSpeed, frameTime), whereframeTimeis the time in seconds that the last frame took to render if the time base isPerSecond, or 1.0 if the time base isPerFrame. If scaling is performed with the 2D valuator, then the valuator's Y value as specified byMatrixIndices2Dis an additional scale applied to the exponent. If scaling is performed by the 6DOF sensor, then the scale speed can be inverted with a negative exponent by using the appropriate listener constructor flag.This property is set in the configuration file read by
ConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> ScaleSpeed <speed> [PerFrame | PerSecond])- Parameters:
speed- array of length 2; first element is aDoublefor the speed, and the second is aStringfor the time base- See Also:
setScaleSpeed(double, int)
-
setScaleSpeed
public void setScaleSpeed(double speed, int timeBase)Sets the scaling speed. The default is 2.0 per second, which means magnification doubles the apparent size of the virtual world every second, and minification halves the apparent size of the virtual world every second.The scaling applied with each frame is
Math.pow(scaleSpeed, frameTime), whereframeTimeis the time in seconds that the last frame took to render if the time base isPER_SECOND, or 1.0 if the time base isPER_FRAME. If scaling is performed with the 2D valuator, then the valuator's Y value as specified bysetMatrixIndices2Dis an additional scale applied to the exponent. If scaling is performed by the 6DOF sensor, then the scale speed can be inverted with a negative exponent by using the appropriate listener constructor flag.- Parameters:
speed- specifies the scale speedtimeBase- eitherPER_SECONDorPER_FRAME
-
getScaleSpeed
public double getScaleSpeed()
Gets the scaling speed.- Returns:
- the scaling speed
-
getScaleTimeBase
public int getScaleTimeBase()
Gets the time base for scaling speed.- Returns:
- the scaling time base
-
TransformCenterSource
public void TransformCenterSource(java.lang.Object[] source)
Property which sets the source of the center of rotation and scale. The default isHotspot, which means the center of rotation or scale is a 6DOF sensor's current hotspot location. The alternative isVworldFixed, which uses the fixed virtual world coordinates specified by theTransformCenterproperty as the center. The latter is also the fallback if a 6DOF sensor is not specified. This property is set in the configuration file read byConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> TransformCenterSource [Hotspot | VworldFixed])- Parameters:
source- array of length 1 containing aString- See Also:
setTransformCenterSource(int)
-
setTransformCenterSource
public void setTransformCenterSource(int source)
Sets the source of the center of rotation and scale. The default isHOTSPOT, which means the center of rotation or scale is a 6DOF sensor's current hotspot location. The alternative isVWORLD_FIXED, which uses the fixed virtual world coordinates specified bysetTransformCenteras the center. The latter is also the fallback if a 6DOF sensor is not specified.The transform center source can be dynamically updated while the behavior is running.
- Parameters:
source- eitherHOTSPOTorVWORLD_FIXED
-
getTransformCenterSource
public int getTransformCenterSource()
Gets the rotation/scale center source.- Returns:
- the rotation/scale center source
-
TransformCenter
public void TransformCenter(java.lang.Object[] center)
Property which sets the center of rotation and scale if theTransformCenterSourceproperty isVworldFixedor if a 6DOF sensor is not specified. The default is (0.0, 0.0, 0.0) in virtual world coordinates. This property is set in the configuration file read byConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> TransformCenter <Point3d>)- Parameters:
center- array of length 1 containing aPoint3d- See Also:
setTransformCenter(javax.vecmath.Point3d)
-
setTransformCenter
public void setTransformCenter(javax.vecmath.Point3d center)
Sets the center of rotation and scale ifsetTransformCenterSourceis called withVWORLD_FIXEDor if a 6DOF sensor is not specified. The default is (0.0, 0.0, 0.0) in virtual world coordinates.The transform center can be dynamically updated while the behavior is running.
- Parameters:
center- point in virtual world coordinates about which to rotate and scale
-
getTransformCenter
public void getTransformCenter(javax.vecmath.Point3d center)
Gets the rotation/scale center in virtual world coordinates.- Parameters:
center-Point3dto receive a copy of the rotation/scale center
-
NominalSensorRotation
public void NominalSensorRotation(java.lang.Object[] matrix)
Property which sets the nominal sensor rotation. The default is the identity transform.This behavior assumes that when a hand-held wand is pointed directly at a screen in an upright position, then its 6DOF sensor's local coordinate system axes (its basis vectors) are nominally aligned with the image plate basis vectors; specifically, that the sensor's -Z axis points toward the screen, the +Y axis points up, and the +X axis points to the right. The translation and rotation listeners provided by this behavior assume this orientation to determine the transforms to be applied to the view platform; for example, translation applies along the sensor Z axis, while rotation applies about axes defined in the sensor XY plane.
This nominal alignment may not hold true depending upon how the sensor is mounted and how the specific
InputDevicesupporting the sensor handles its orientation. TheNominalSensorRotationproperty can be used to correct the alignment by specifying the rotation needed to transform vectors from the nominal sensor coordinate system, aligned with the image plate coordinate system as described above, to the sensor's actual local coordinate system.NOTE: the nominal sensor transform applies only to the translation directions and rotation axes created by the listeners defined in this behavior; for compatibility with the core Java 3D API, sensor reads and the sensor hotspot location are still expressed in the sensor's local coordinate system.
This property is set in the configuration file read by
ConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> NominalSensorRotation [<Matrix4d> | <Matrix3d>])- Parameters:
matrix- array of length 1 containing aMatrix4dorMatrix3d- See Also:
setNominalSensorRotation(javax.media.j3d.Transform3D)
-
setNominalSensorRotation
public void setNominalSensorRotation(Transform3D transform)
Sets the nominal sensor transform. The default is the identity transform.This behavior assumes that when a hand-held wand is pointed directly at a screen in an upright position, then its 6DOF sensor's local coordinate system axes (its basis vectors) are nominally aligned with the image plate basis vectors; specifically, that the sensor's -Z axis points toward the screen, the +Y axis points up, and the +X axis points to the right. The translation and rotation listeners provided by this behavior assume this orientation to determine the transforms to be applied to the view platform, in that translation applies along the sensor Z axis, and rotation applies about axes defined in the sensor XY plane.
This nominal alignment may not hold true depending upon how the sensor is mounted and how the specific
InputDevicesupporting the sensor handles its orientation.setNominalSensorRotationcan be called to correct the alignment by specifying the rotation needed to transform vectors from the nominal sensor coordinate system, aligned with the image plate coordinate system as described above, to the sensor's actual local coordinate system.NOTE: the nominal sensor transform applies only to the translation directions and rotation axes created by the listeners defined in this behavior; for compatibility with the core Java 3D API, sensor reads and the sensor hotspot location are still expressed in the sensor's local coordinate system.
- Parameters:
transform- Rotates vectors from the nominal sensor coordinate system system to the sensor's local coordinate system; only the rotational components are used. May be setnullfor identity.
-
getNominalSensorRotation
public void getNominalSensorRotation(Transform3D t3d)
Gets the nominal sensor transform.- Parameters:
t3d-Transform3Dto receive a copy of the nominal sensor transform
-
ResetViewButtonCount6D
public void ResetViewButtonCount6D(java.lang.Object[] count)
Property which sets the number of buttons to be pressed simultaneously on the 6DOF sensor in order to reset the view back to the home transform. The value must be greater than 1; the default is 3. A value ofNonedisables this action. This property is set in the configuration file read byConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> ResetViewButtonCount6D [<count> | None])- Parameters:
count- array of length 1 containing aDoubleorString- See Also:
setResetViewButtonCount6D(int),ViewPlatformBehavior.setHomeTransform
-
setResetViewButtonCount6D
public void setResetViewButtonCount6D(int count)
Sets the number of buttons to be pressed simultaneously on the 6DOF sensor in order to reset the view back to the home transform. The value must be greater than 1; the default is 3. A value ofNONEdisables this action.- Parameters:
count- eitherNONEor button count > 1- See Also:
ViewPlatformBehavior.setHomeTransform
-
getResetViewButtonCount6D
public int getResetViewButtonCount6D()
Gets the number of buttons to be pressed simultaneously on the 6DOF sensor in order to reset the view back to the home transform. A value ofNONEindicates this action is disabled.- Returns:
- the number of buttons to press simultaneously for a view reset
-
ResetViewButtonCount2D
public void ResetViewButtonCount2D(java.lang.Object[] count)
Property which sets the number of buttons to be pressed simultaneously on the 2D valuator in order to reset the view back to the home transform. The value must be greater than 1; the default isNone. A value ofNonedisables this action. This property is set in the configuration file read byConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> ResetViewButtonCount2D [<count> | None])- Parameters:
count- array of length 1 containing aDoubleorString- See Also:
setResetViewButtonCount2D(int),ViewPlatformBehavior.setHomeTransform
-
setResetViewButtonCount2D
public void setResetViewButtonCount2D(int count)
Sets the number of buttons to be pressed simultaneously on the 2D valuator in order to reset the view back to the home transform. The value must be greater than 1; the default isNONE. A value ofNONEdisables this action.- Parameters:
count- eitherNONEor button count > 1- See Also:
ViewPlatformBehavior.setHomeTransform
-
getResetViewButtonCount2D
public int getResetViewButtonCount2D()
Gets the number of buttons to be pressed simultaneously on the 2D valuator in order to reset the view back to the home transform. A value ofNONEindicates this action is disabled.- Returns:
- the number of buttons to press simultaneously for a view reset
-
EchoType
public void EchoType(java.lang.Object[] type)
Property which sets the 6DOF sensor echo type. The default isGnomon, which displays an object with points indicating the direction of each of the sensor's coordinate system axes at the location of the sensor's hotspot. The alternative isBeam, which displays a beam from the sensor's origin to the location of the sensor's hotspot; the hotspot must not be (0, 0, 0) or anIllegalArgumentExceptionwill result. The width of each of these echo types is specified by theEchoSizeproperty. TheEchoTypeproperty is set in the configuration file read byConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> EchoType [Gnomon | Beam | None])- Parameters:
type- array of length 1 containing aString- See Also:
setEchoType(int)
-
setEchoType
public void setEchoType(int type)
Sets the 6DOF sensor echo type. The default isGNOMON, which displays an object with points indicating the direction of each of the sensor's coordinate axes at the location of the sensor's hotspot. The alternative isBEAM, which displays a beam from the sensor's origin to the location of the sensor's hotspot; the hotspot must not be (0, 0, 0) or anIllegalArgumentExceptionwill result. The width of each of these echo types is specified bysetEchoSize.- Parameters:
type-GNOMON,BEAM, orNONEare recognized
-
getEchoType
public int getEchoType()
Gets the echo type.- Returns:
- the echo type
-
EchoSize
public void EchoSize(java.lang.Object[] echoSize)
Property which sets the size of the 6DOF sensor echo in physical meters. This is used for the width of the gnomon and beam echoes. The default is 1 centimeter. This property is set in the configuration file read byConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> EchoSize <size>)- Parameters:
echoSize- array of length 1 containing aDouble- See Also:
setEchoSize(double)
-
setEchoSize
public void setEchoSize(double echoSize)
Sets the size of the 6DOF sensor echo in physical meters. This is used for the width of the gnomon and beam echoes. The default is 1 centimeter.- Parameters:
echoSize- the size in meters
-
getEchoSize
public double getEchoSize()
Gets the size of the 6DOF sensor echo in meters.- Returns:
- the echo size
-
EchoColor
public void EchoColor(java.lang.Object[] color)
Property which sets the color of the 6DOF sensor echo. The default is white. This property is set in the configuration file read byConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> EchoColor <red> <green> <blue>)- Parameters:
color- array of length 3 containingDoubles- See Also:
setEchoColor(javax.vecmath.Color3f)
-
setEchoColor
public void setEchoColor(javax.vecmath.Color3f color)
Sets the color of the 6DOF sensor echo. The default is white. This can be called to set the color before or after the echo geometry is created.- Parameters:
color- the echo color
-
getEchoColor
public void getEchoColor(javax.vecmath.Color3f color)
Gets the 6DOF sensor echo color.- Parameters:
color- theColor3finto which to copy the echo color
-
EchoTransparency
public void EchoTransparency(java.lang.Object[] transparency)
Property which sets the 6DOF sensor echo transparency. The default is opaque. A value of 0.0 is fully opaque and 1.0 is fully transparent. This property is set in the configuration file read byConfiguredUniverse.Syntax:
(ViewPlatformBehaviorProperty <name> EchoTransparency <transparency>)- Parameters:
transparency- array of length 1 containing aDouble- See Also:
setEchoTransparency(float)
-
setEchoTransparency
public void setEchoTransparency(float transparency)
Sets the 6DOF sensor echo transparency. The default is opaque. A value of 0.0 is fully opaque and 1.0 is fully transparent. This can be called to set the transparency before or after the echo geometry is created.- Parameters:
transparency- the transparency value
-
getEchoTransparency
public float getEchoTransparency()
Gets the 6DOF sensor echo transparency value.- Returns:
- the transparency value
-
setEchoTransformGroup
public void setEchoTransformGroup(TransformGroup echo)
Sets the transform group containing a 6DOF sensor's echo geometry. This is used to specify a custom echo. Its transform will be manipulated to represent the position and orientation of the 6DOF sensor. Capabilities to allow writing its transform and to read, write, and extend its children will be set.This method must be called before the behavior is made live in order to have an effect.
- Parameters:
echo- theTransformGroupcontaining the echo geometry
-
getEchoTransformGroup
public TransformGroup getEchoTransformGroup()
Gets the transform group containing a 6DOF sensor's echo geometry. Capabilities to write its transform and read, write, and extend its children are granted.- Returns:
- the echo's transform group
-
getEchoGeometry
public Shape3D getEchoGeometry()
Gets theShape3Ddefining the 6DOF sensor's echo geometry and appearance. The returnedShape3Dallows appearance read and write. If a custom echo was supplied by providing the echo transform group directly then the return value will benull.- Returns:
- the echo geometry, or
nullif a custom echo was supplied
-
getSensorEventAgent
public SensorEventAgent getSensorEventAgent()
Gets theSensorEventAgentused by this behavior. Sensor event generation is delegated to this agent. This can be accessed to manipulate the sensor button and read action bindings directly.- Returns:
- the sensor event agent
-
-