|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.media.j3d.Sensor
The Sensor Class encapsulates an object that provides real-time data. Examples include six-degree-of-freedom tracking, a joystick, or a data file being read back during a program. A sensor must be used in conjuction with an implementation of the InputDevice interface. Sensor data is time-stamped. Sensor can also handle button inputs.
Field Summary | |
static int |
DEFAULT_SENSOR_READ_COUNT
Default SensorRead object count (30); the number of SensorRead objects constructed if no count is specified. |
static int |
HAND_PREDICTOR
Set the predictor policy to assume the sensor is predicting hand position/orientation |
static int |
HEAD_PREDICTOR
Set the predictor policy to assume the sensor is predicting head position/orientation |
static int |
NO_PREDICTOR
Use no prediction policy; this is the default |
static int |
PREDICT_NEXT_FRAME_TIME
Set predictor type to generate the SensorRead to correspond with the next frame time |
static int |
PREDICT_NONE
Set predictor type to do no prediction; this is the default |
Constructor Summary | |
Sensor(InputDevice device)
Constructs a Sensor object for the specified input device using default parameters. |
|
Sensor(InputDevice device,
int sensorReadCount)
Constructs a Sensor object for the specified input device using the specified number of SensorRead objects. |
|
Sensor(InputDevice device,
int sensorReadCount,
int sensorButtonCount)
Constructs a Sensor object for the specified input device using the specified number of SensorRead objects and number of buttons. |
|
Sensor(InputDevice device,
int sensorReadCount,
int sensorButtonCount,
Point3d hotspot)
Constructs a Sensor object for the specified input device using the specified number of SensorRead objects, number of buttons, and hotspot. |
|
Sensor(InputDevice device,
int sensorReadCount,
Point3d hotspot)
Constructs a Sensor object for the specified input device using the specified number of SensorRead objects and hotspot. |
|
Sensor(InputDevice device,
Point3d hotspot)
Constructs a Sensor object for the specified input device using the specified hotspot. |
Method Summary | |
SensorRead |
getCurrentSensorRead()
Get the current sensor read. |
InputDevice |
getDevice()
Retrieves the sensor's associated input device |
void |
getHotspot(Point3d hotspot)
Get the sensor's hotspot offset in this sensor's coordinate system. |
int |
getPredictionPolicy()
This function returns the prediction policy used by this sensor. |
int |
getPredictor()
This function returns the type of predictor used by this sensor. |
void |
getRead(Transform3D read)
Computes the sensor reading consistent with the prediction policy and copies that value into the specified argument; calling this method with a prediction policy of NO_PREDICTOR will return the last sensor reading; calling this method with a prediction policy of HAND_PREDICTOR, or HEAD_PREDICTOR will extrapolate previous sensor readings to the current time. |
void |
getRead(Transform3D read,
long deltaT)
Computes the sensor reading consistent as of time deltaT in the future and copies that value into the specified argument; the reading is computed using the current prediction policy; a prediction policy of NO_PREDICTOR will yield the most recent sensor reading for any deltaT argument (ie, this method is the same as getRead for a prediction policy of NO_PREDICTOR). |
int |
getSensorButtonCount()
This function returns the number of buttons associated with this sensor. |
int |
getSensorReadCount()
This function returns the number of SensorRead objects associated with this sensor. |
int |
lastButtons()
Deprecated. Use lastButtons(int[] values) instead. |
int |
lastButtons(int k)
Deprecated. Use lastButtons(int k, int[] values) instead. |
void |
lastButtons(int[] values)
Places the most recent sensor reading value for each button into the array parameter; will throw an ArrayIndexOutOfBoundsException if values.length is less than the number of buttons. |
void |
lastButtons(int k,
int[] values)
Places the kth most recent sensor reading value for each button into the array parameter; where k=0 is the most recent sensor reading, k=1 is the next most recent sensor reading, etc.; will throw an ArrayIndexOutOfBoundsException if values.length is less than the number of buttons. |
void |
lastRead(Transform3D read)
Extracts the most recent sensor reading and copies that value into the specified argument. |
void |
lastRead(Transform3D read,
int kth)
Extracts the kth most recent sensor reading and copies that value into the specified argument; where 0 is the most recent sensor reading, 1 is the next most recent sensor reading, etc. |
long |
lastTime()
Returns the time associated with the most recent sensor reading. |
long |
lastTime(int k)
Returns the time associated with the kth most recent sensor reading; where 0 is the most recent sensor reading, 1 is the next most recent sensor reading, etc. |
void |
setDevice(InputDevice device)
Set the sensor's associated input device |
void |
setHotspot(Point3d hotspot)
Set the sensor's hotspot offset in this sensor's coordinate system; this value will be subtracted from the translation component of each transform sent to the Sensor object via the setNextSensorRead call. |
void |
setNextSensorRead(long time,
Transform3D transform,
int buttons)
Deprecated. Use setNextSensorRead(long time, Transform3D transform, int[] buttons) instead. |
void |
setNextSensorRead(long time,
Transform3D transform,
int[] values)
Sets the next sensor read to the specified values; once these values are set via this method they become the current values returned by methods such as lastRead(), lastTime() and lastButtons(); note that if there are no buttons associated with this sensor then values can just be an empty array. |
void |
setNextSensorRead(SensorRead read)
Sets the next sensor read to the specified values; once these values are set via this method they become the current values returned by methods such as lastRead(), lastTime() and lastButtons(). |
void |
setPredictionPolicy(int policy)
This function sets the prediction policy use by this sensor. |
void |
setPredictor(int predictor)
This function set the type of predictor to use with this sensor. |
void |
setSensorReadCount(int count)
Set the number of sensor read objects per Sensor. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int PREDICT_NONE
public static final int PREDICT_NEXT_FRAME_TIME
public static final int NO_PREDICTOR
public static final int HEAD_PREDICTOR
public static final int HAND_PREDICTOR
public static final int DEFAULT_SENSOR_READ_COUNT
Constructor Detail |
public Sensor(InputDevice device)
device
- the Sensor's associated device.public Sensor(InputDevice device, int sensorReadCount)
device
- the Sensor's associated device.sensorReadCount
- the number of SensorReads to associate with
this sensor.public Sensor(InputDevice device, int sensorReadCount, int sensorButtonCount)
device
- the Sensor's associated device.sensorReadCount
- the number of SensorReads to associate with
this sensor.sensorButtonCount
- the number of buttons associated with each
sensor read.public Sensor(InputDevice device, Point3d hotspot)
device
- the Sensor's associated device.hotspot
- the Sensor's hotspot defined in its local coordinate
system.public Sensor(InputDevice device, int sensorReadCount, Point3d hotspot)
device
- the Sensor's associated device.sensorReadCount
- the number of SensorReads to associate with
this sensor.hotspot
- the Sensor's hotspot defined in its local coordinate
system.public Sensor(InputDevice device, int sensorReadCount, int sensorButtonCount, Point3d hotspot)
device
- the Sensor's associated device.sensorReadCount
- the number of SensorReads to associate with
this sensor.sensorButtonCount
- the number of buttons associated with each
sensor read.hotspot
- the Sensor's hotspot defined in its local coordinate
system.Method Detail |
public void setPredictor(int predictor)
predictor
- predictor type one of PREDICT_NONE or
PREDICT_NEXT_FRAME_TIME.public int getPredictor()
public void setPredictionPolicy(int policy)
policy
- prediction policy one of NO_PREDICTOR, HEAD_PREDICTOR,
or HAND_PREDICTOR.public int getPredictionPolicy()
public void setHotspot(Point3d hotspot)
hotspot
- the sensor's new hotspotpublic void getHotspot(Point3d hotspot)
hotspot
- the variable to receive the sensor's hotspotpublic void setDevice(InputDevice device)
device
- the sensor's new devicepublic InputDevice getDevice()
public void getRead(Transform3D read)
read
- The matrix that will receive the predicted sensor readingpublic void getRead(Transform3D read, long deltaT)
read
- The matrix that will receive the predicted sensor readingdeltaT
- The time delta into the future for this readpublic void lastRead(Transform3D read)
read
- The matrix that will receive the most recent sensor readingpublic void lastRead(Transform3D read, int kth)
read
- The matrix that will receive the most recent sensor readingk
- The kth previous sensor readingpublic long lastTime()
public long lastTime(int k)
public void lastButtons(int[] values)
values
- the array into which the button values will be
placed.public int lastButtons()
public void lastButtons(int k, int[] values)
k
- the time associated with the most recent sensor readingvalues
- the array into which the button values will be
placed.public int lastButtons(int k)
public final int getSensorReadCount()
public void setSensorReadCount(int count)
count
- the new sensor read countpublic final int getSensorButtonCount()
public SensorRead getCurrentSensorRead()
public void setNextSensorRead(long time, Transform3D transform, int[] values)
time
- The next SensorRead's associated timetransform
- The next SensorRead's transformationvalues
- The next SensorRead's buttons' statespublic void setNextSensorRead(SensorRead read)
read
- The next SensorRead's valuespublic void setNextSensorRead(long time, Transform3D transform, int buttons)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |