opal::RaycastSensor Class Reference

#include <RaycastSensor.h>

Inheritance diagram for opal::RaycastSensor:

opal::Sensor List of all members.

Public Member Functions

 RaycastSensor (Simulator *s)
virtual ~RaycastSensor ()
virtual void OPAL_CALL init (const RaycastSensorData &data)
virtual const RaycastSensorData
&OPAL_CALL 
getData () const
virtual const RaycastResult
&OPAL_CALL 
fireRay ()
virtual const std::vector<
RaycastResult > &OPAL_CALL 
firePiercingRay ()
virtual const RaycastResult
&OPAL_CALL 
fireRay (real length)
virtual const std::vector<
RaycastResult > &OPAL_CALL 
firePiercingRay (real length)
virtual void OPAL_CALL setEnabled (bool e)
virtual bool OPAL_CALL isEnabled () const
virtual void OPAL_CALL setRay (const Rayr &r)
virtual const Rayr &OPAL_CALL getRay () const
virtual void OPAL_CALL setTransform (const Matrix44r &t)
virtual const Matrix44r &OPAL_CALL getTransform () const
virtual SensorType OPAL_CALL getType () const
virtual void OPAL_CALL setName (const std::string &name)
virtual const std::string
&OPAL_CALL 
getName () const
virtual void OPAL_CALL internal_update ()
virtual bool OPAL_CALL internal_dependsOnSolid (Solid *s)

Protected Attributes

RaycastSensorData mData
SimulatormSim

Detailed Description

A Sensor that fires a ray into a scene and returns data describing the closest intersection, if any. This Sensor does not fire a ray every time step because that would be a waste of time in most cases; it must be "fired" manually.

Definition at line 93 of file RaycastSensor.h.


Constructor & Destructor Documentation

opal::RaycastSensor::RaycastSensor Simulator s  ) 
 

Constructor.

Definition at line 39 of file RaycastSensor.cpp.

References mSim.

opal::RaycastSensor::~RaycastSensor  )  [virtual]
 

Destructor.

Definition at line 45 of file RaycastSensor.cpp.


Member Function Documentation

const vector< RaycastResult > & opal::RaycastSensor::firePiercingRay real  length  )  [virtual]
 

Same as the other firePiercingRay, except that the length is an explicit parameter.

Parameters:
length The maximum distance of the ray cast.
Returns:
All intersections, sorted by their distance from the base of the ray.

Definition at line 115 of file RaycastSensor.cpp.

References opal::RaycastSensorData::contactGroup, opal::SensorData::enabled, opal::Solid::getTransform(), opal::Simulator::internal_fireRay(), mData, mSim, opal::RaycastSensorData::ray, opal::SensorData::solid, and opal::SensorData::transform.

const vector< RaycastResult > & opal::RaycastSensor::firePiercingRay  )  [virtual]
 

Same as fireRay, except that this function returns a set of sorted results.

Note:
The length of the ray will be the RaycastSensorData length.
Returns:
All intersections, sorted by their distance from the base of the ray.

Definition at line 64 of file RaycastSensor.cpp.

References opal::Rayr::getLength(), mData, and opal::RaycastSensorData::ray.

const RaycastResult & opal::RaycastSensor::fireRay real  length  )  [virtual]
 

Same as the other fireRay, except that the length is an explicit parameter.

Parameters:
length The maximum distance of the ray cast.
Returns:
The closest intersection that was encountered.

Definition at line 69 of file RaycastSensor.cpp.

References opal::RaycastSensorData::contactGroup, opal::distance(), opal::SensorData::enabled, opal::Solid::getTransform(), opal::Simulator::internal_fireRay(), mData, mSim, opal::RaycastSensorData::ray, opal::SensorData::solid, and opal::SensorData::transform.

const RaycastResult & opal::RaycastSensor::fireRay  )  [virtual]
 

Fires a ray into the Sensor's environment, returning information about the closest intersection encountered. The length of the ray used will be the RaycastSensorData length.

Definition at line 59 of file RaycastSensor.cpp.

References opal::Rayr::getLength(), mData, and opal::RaycastSensorData::ray.

const RaycastSensorData & opal::RaycastSensor::getData  )  const [virtual]
 

Returns all data describing the Sensor.

Definition at line 54 of file RaycastSensor.cpp.

References mData.

const std::string & opal::RaycastSensor::getName  )  const [virtual]
 

Returns the Sensor's name.

Implements opal::Sensor.

Definition at line 198 of file RaycastSensor.cpp.

References mData, and opal::SensorData::name.

const Rayr & opal::RaycastSensor::getRay  )  const [virtual]
 

Returns the Sensor's ray.

Definition at line 173 of file RaycastSensor.cpp.

References mData, and opal::RaycastSensorData::ray.

const Matrix44r & opal::RaycastSensor::getTransform  )  const [virtual]
 

Returns the Sensor's transform.

Implements opal::Sensor.

Definition at line 188 of file RaycastSensor.cpp.

References mData, and opal::SensorData::transform.

SensorType opal::RaycastSensor::getType  )  const [virtual]
 

Returns the Sensor type.

Implements opal::Sensor.

Definition at line 178 of file RaycastSensor.cpp.

References opal::SensorData::getType(), and mData.

void opal::RaycastSensor::init const RaycastSensorData data  )  [virtual]
 

Initializes the Sensor with the given data structure. If the Solid pointer in the data is valid, the Sensor's offset will be relative to the Solid's transform instead of the global origin.

Definition at line 48 of file RaycastSensor.cpp.

References opal::Sensor::init(), and mData.

bool opal::RaycastSensor::internal_dependsOnSolid Solid s  )  [virtual]
 

Returns true if this Sensor depends on the given Solid.

Reimplemented from opal::Sensor.

Definition at line 211 of file RaycastSensor.cpp.

References mData, and opal::SensorData::solid.

void opal::RaycastSensor::internal_update  )  [virtual]
 

Called regularly to update the Sensor. This does nothing if the Sensor is disabled.

Implements opal::Sensor.

Definition at line 203 of file RaycastSensor.cpp.

References opal::SensorData::enabled, mData, and opal::SensorData::solid.

bool opal::RaycastSensor::isEnabled  )  const [virtual]
 

Returns true if the Sensor is enabled.

Implements opal::Sensor.

Definition at line 163 of file RaycastSensor.cpp.

References opal::SensorData::enabled, and mData.

void opal::RaycastSensor::setEnabled bool  e  )  [virtual]
 

Sets whether the Sensor can update its measurements.

Implements opal::Sensor.

Definition at line 153 of file RaycastSensor.cpp.

References opal::SensorData::enabled, and mData.

void opal::RaycastSensor::setName const std::string &  name  )  [virtual]
 

Sets the Sensor's name.

Implements opal::Sensor.

Definition at line 193 of file RaycastSensor.cpp.

References mData, and opal::SensorData::name.

void opal::RaycastSensor::setRay const Rayr r  )  [virtual]
 

Sets the Sensor's ray.

Definition at line 168 of file RaycastSensor.cpp.

References mData, and opal::RaycastSensorData::ray.

void opal::RaycastSensor::setTransform const Matrix44r t  )  [virtual]
 

Sets the Sensor's transform.

Implements opal::Sensor.

Definition at line 183 of file RaycastSensor.cpp.

References mData, and opal::SensorData::transform.


Member Data Documentation

RaycastSensorData opal::RaycastSensor::mData [protected]
 

Stores data describing the Sensor.

Definition at line 166 of file RaycastSensor.h.

Referenced by firePiercingRay(), fireRay(), getData(), getName(), getRay(), getTransform(), getType(), init(), internal_dependsOnSolid(), internal_update(), isEnabled(), setEnabled(), setName(), setRay(), and setTransform().

Simulator* opal::RaycastSensor::mSim [protected]
 

Pointer to the Simulator containing this Sensor; used to fire rays into the Simulator.

Definition at line 170 of file RaycastSensor.h.

Referenced by firePiercingRay(), fireRay(), and RaycastSensor().


The documentation for this class was generated from the following files:
Generated on Tue May 16 17:49:57 2006 for OPAL by  doxygen 1.4.6-NO