Package javax.media.j3d
Class SensorRead
- java.lang.Object
-
- javax.media.j3d.SensorRead
-
public class SensorRead extends java.lang.Object
A SensorRead encapsulates all the information associated with a single reading of a sensor, including a timestamp, a transform, and, optionally, button values.
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAXIMUM_SENSOR_BUTTON_COUNT
The maximum number of sensor-attached buttons tracked on a per sensor basis.
-
Constructor Summary
Constructors Constructor Description SensorRead()
Constructs a SensorRead object with default parameters.SensorRead(int numButtons)
Constructs a SensorRead object with the specified number of buttons.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
get(Transform3D result)
Retrieve the SensorRead's transform and place it in resultvoid
getButtons(int[] values)
Copies the array of button values for this SensorRead object into the specified array.int
getNumButtons()
Returns the number of buttons associated with this SensorRead object.long
getTime()
Retrieve this SensorRead's associated time stampvoid
set(Transform3D t1)
Set the SensorRead's transform to the value specifiedvoid
setButtons(int[] values)
Sets the values of all buttons for this SensorRead object.void
setTime(long time)
Sets this SensorRead's time stamp to the specified argument
-
-
-
Field Detail
-
MAXIMUM_SENSOR_BUTTON_COUNT
public static final int MAXIMUM_SENSOR_BUTTON_COUNT
The maximum number of sensor-attached buttons tracked on a per sensor basis.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SensorRead
public SensorRead()
Constructs a SensorRead object with default parameters. The default values are as follows:-
number of buttons : 0
button values : 0 (for all array elements)
transform : identity
time : current time
-
SensorRead
public SensorRead(int numButtons)
Constructs a SensorRead object with the specified number of buttons.- Parameters:
numButtons
- the number of buttons for this SensorRead
-
-
Method Detail
-
set
public void set(Transform3D t1)
Set the SensorRead's transform to the value specified- Parameters:
t1
- this sensor's reading
-
get
public void get(Transform3D result)
Retrieve the SensorRead's transform and place it in result- Parameters:
result
- the recipient of the this sensor's reading
-
setTime
public void setTime(long time)
Sets this SensorRead's time stamp to the specified argument- Parameters:
time
- the time to associate with this reading
-
getTime
public long getTime()
Retrieve this SensorRead's associated time stamp- Returns:
- the SensorRead's time as a long
-
setButtons
public void setButtons(int[] values)
Sets the values of all buttons for this SensorRead object.- Parameters:
values
- array contining the new buttons for this SensorRead- Throws:
java.lang.ArrayIndexOutOfBoundsException
- if this object has 0 buttons or if values.length is less than the number of buttons in this object.
-
getButtons
public void getButtons(int[] values)
Copies the array of button values for this SensorRead object into the specified array. This method has no effect if this SensorRead object has 0 buttons. The array must be large enough to hold all of the buttons.- Parameters:
values
- array that will receive the values of all buttons for this SensorRead
-
getNumButtons
public int getNumButtons()
Returns the number of buttons associated with this SensorRead object.- Returns:
- the number of buttons associated with this SensorRead object
- Since:
- Java 3D 1.2
-
-