📄 sensor.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Fri Apr 18 11:16:31 PDT 2003 --><TITLE>Sensor (Java 3D API)</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"></HEAD><SCRIPT>function asd(){parent.document.title="Sensor (Java 3D API)";}</SCRIPT><BODY BGCOLOR="white" onload="asd();"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/media/j3d/Screen3D.html"><B>PREV CLASS</B></A> <A HREF="../../../javax/media/j3d/SensorRead.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="Sensor.html" TARGET="_top"><B>NO FRAMES</B></A> <SCRIPT> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT><A HREF="../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.media.j3d</FONT><BR>Class Sensor</H2><PRE>java.lang.Object | +--<B>javax.media.j3d.Sensor</B></PRE><HR><DL><DT>public class <B>Sensor</B><DT>extends java.lang.Object</DL><P>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.<P> The Sensor object provides an abstract concept of a hardware input device. A Sensor consists of a timestamped sequence of input values and the state of buttons or switches at the time that Java 3D sampled the value. A sensor also contains a hotspot offset specified in the sensor's local coordinate system. If not specified, the hotspot is (0.0, 0.0, 0.0).<P> Since a typical hardware environment may contain multiple sensing elements, Java 3D maintains an array of sensors. Users can access a sensor directly from their Java code or they can assign a sensor to one of Java 3D's predefined 6DOF entities, such as UserHead.<P> Using a sensor is as easy as accessing an object. Write your Java code to extract the associated sensor value from the array of sensors. You can then directly apply that value to an element in a scene graph or process the sensor values in whatever way necessary.<P> Java 3D includes three special six-degrees-of-freedom (6DOF) entities. These include UserHead, DominantHand, and NondominantHand. You can assign or change which sensor drives one of these predefined entities. Java 3D uses the specified sensor to drive the 6DOF entity - most visibly the View.<P> Java 3D does not provide raw tracker or joystick-generated data in a sensor. At a minimum, Java 3D normalizes the raw data using the registration and calibration parameters either provided by or provided for the end user. It additionally may filter and process the data to remove noise and improve latency. The application programmer can suppress this latter effect on a sensor-by-sensor basis.<P><P><P><DL><DT><B>See Also:</B><DD><A HREF="../../../javax/media/j3d/SensorRead.html"><CODE>SensorRead</CODE></A></DL><HR><P><!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#DEFAULT_SENSOR_READ_COUNT">DEFAULT_SENSOR_READ_COUNT</A></B></CODE><BR> Default SensorRead object count (30); the number of SensorRead objects constructed if no count is specified.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#HAND_PREDICTOR">HAND_PREDICTOR</A></B></CODE><BR> Set the predictor policy to assume the sensor is predicting hand position/orientation.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#HEAD_PREDICTOR">HEAD_PREDICTOR</A></B></CODE><BR> Set the predictor policy to assume the sensor is predicting head position/orientation.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#NO_PREDICTOR">NO_PREDICTOR</A></B></CODE><BR> Use no prediction policy; this is the default.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#PREDICT_NEXT_FRAME_TIME">PREDICT_NEXT_FRAME_TIME</A></B></CODE><BR> Set predictor type to generate the SensorRead to correspond with the next frame time.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#PREDICT_NONE">PREDICT_NONE</A></B></CODE><BR> Set predictor type to do no prediction; this is the default.</TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#Sensor(javax.media.j3d.InputDevice)">Sensor</A></B>(<A HREF="../../../javax/media/j3d/InputDevice.html">InputDevice</A> device)</CODE><BR> Constructs a Sensor object for the specified input device using default parameters.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#Sensor(javax.media.j3d.InputDevice, int)">Sensor</A></B>(<A HREF="../../../javax/media/j3d/InputDevice.html">InputDevice</A> device, int sensorReadCount)</CODE><BR> Constructs a Sensor object for the specified input device using the specified number of SensorRead objects.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#Sensor(javax.media.j3d.InputDevice, int, int)">Sensor</A></B>(<A HREF="../../../javax/media/j3d/InputDevice.html">InputDevice</A> device, int sensorReadCount, int sensorButtonCount)</CODE><BR> Constructs a Sensor object for the specified input device using the specified number of SensorRead objects and number of buttons.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#Sensor(javax.media.j3d.InputDevice, int, int, javax.vecmath.Point3d)">Sensor</A></B>(<A HREF="../../../javax/media/j3d/InputDevice.html">InputDevice</A> device, int sensorReadCount, int sensorButtonCount, <A HREF="../../../javax/vecmath/Point3d.html">Point3d</A> hotspot)</CODE><BR> Constructs a Sensor object for the specified input device using the specified number of SensorRead objects, number of buttons, and hotspot.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#Sensor(javax.media.j3d.InputDevice, int, javax.vecmath.Point3d)">Sensor</A></B>(<A HREF="../../../javax/media/j3d/InputDevice.html">InputDevice</A> device, int sensorReadCount, <A HREF="../../../javax/vecmath/Point3d.html">Point3d</A> hotspot)</CODE><BR> Constructs a Sensor object for the specified input device using the specified number of SensorRead objects and hotspot.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#Sensor(javax.media.j3d.InputDevice, javax.vecmath.Point3d)">Sensor</A></B>(<A HREF="../../../javax/media/j3d/InputDevice.html">InputDevice</A> device, <A HREF="../../../javax/vecmath/Point3d.html">Point3d</A> hotspot)</CODE><BR> Constructs a Sensor object for the specified input device using the specified hotspot.</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../javax/media/j3d/SensorRead.html">SensorRead</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#getCurrentSensorRead()">getCurrentSensorRead</A></B>()</CODE><BR> Gets the current sensor read.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../../javax/media/j3d/InputDevice.html">InputDevice</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#getDevice()">getDevice</A></B>()</CODE><BR> Retrieves the sensor's associated input device.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#getHotspot(javax.vecmath.Point3d)">getHotspot</A></B>(<A HREF="../../../javax/vecmath/Point3d.html">Point3d</A> hotspot)</CODE><BR> Get the sensor's hotspot in this sensor's coordinate system.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#getPredictionPolicy()">getPredictionPolicy</A></B>()</CODE><BR> This function returns the prediction policy used by this sensor.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#getPredictor()">getPredictor</A></B>()</CODE><BR> This function returns the type of predictor used by this sensor.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#getRead(javax.media.j3d.Transform3D)">getRead</A></B>(<A HREF="../../../javax/media/j3d/Transform3D.html">Transform3D</A> read)</CODE><BR> 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.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#getRead(javax.media.j3d.Transform3D, long)">getRead</A></B>(<A HREF="../../../javax/media/j3d/Transform3D.html">Transform3D</A> read, long deltaT)</CODE><BR> 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 (i.e., this method is the same as getRead for a prediction policy of NO_PREDICTOR).</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#getSensorButtonCount()">getSensorButtonCount</A></B>()</CODE><BR> Returns the number of buttons associated with this sensor.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#getSensorReadCount()">getSensorReadCount</A></B>()</CODE><BR> Returns the number of SensorRead objects associated with this sensor.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#lastButtons(int[])">lastButtons</A></B>(int[] values)</CODE><BR> 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.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/media/j3d/Sensor.html#lastButtons(int, int[])">lastButtons</A></B>(int k, int[] values)</CODE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -