Gazebo Rendering

API Reference

9.0.0
RayQuery Class Referenceabstract

A Ray Query class used for computing ray object intersections. More...

#include <gz/rendering/RayQuery.hh>

Public Member Functions

virtual ~RayQuery ()
 Destructor.
 
virtual RayQueryResult ClosestPoint (bool _forceSceneUpdate=true)=0
 Compute intersections.
 
virtual math::Vector3d Direction () const =0
 Get ray direction.
 
virtual math::Vector3d Origin () const =0
 Get ray origin.
 
virtual void SetDirection (const math::Vector3d &_dir)=0
 Set ray direction.
 
virtual void SetFromCamera (const CameraPtr &_camera, const math::Vector2d &_coord)=0
 Create the ray query from camera.
 
virtual void SetFromCamera (const WideAngleCameraPtr &_camera, uint32_t _faceIdx, const math::Vector2d &_coord)=0
 Create the ray query from WideAngleCamera.
 
virtual void SetOrigin (const math::Vector3d &_origin)=0
 Set ray origin.
 
virtual void SetPreferGpu (bool _preferGpu)=0
 If possible & supported (and user called SetFromCamera()) will use the GPU to perform the ray query. Triangle-level accurate.
 
virtual bool UsesGpu () const =0
 Returns true if the GPU will be used for the next ClosestPoint() call.
 
- Public Member Functions inherited from Object
virtual ~Object ()
 Destructor.
 
virtual void Destroy ()=0
 Destroy any resources associated with this object. Invoking any other functions after destroying an object will result in undefined behavior.
 
virtual unsigned int Id () const =0
 Get the object ID. This ID will be unique across all objects inside a given scene, but necessarily true for objects across different scenes.
 
virtual std::string Name () const =0
 Get the object name. This name will be unique across all objects inside a given scene, but necessarily true for objects across different scenes.
 
virtual void PostRender ()=0
 Post process this object and any of its children after rendering.
 
virtual void PreRender ()=0
 Prepare this object and any of its children for rendering. This should be called for each object in a scene just before rendering, which can be achieved by a single call to Scene::PreRender.
 
virtual ScenePtr Scene () const =0
 Get the Scene that created this object.
 

Detailed Description

A Ray Query class used for computing ray object intersections.

Constructor & Destructor Documentation

◆ ~RayQuery()

virtual ~RayQuery ( )
virtual

Destructor.

Member Function Documentation

◆ ClosestPoint()

virtual RayQueryResult ClosestPoint ( bool  _forceSceneUpdate = true)
pure virtual

Compute intersections.

Parameters
[in]_forceSceneUpdatePerformance optimization hint When true Ogre2 will update all derived transforms to their latest to get correct results.

When false, that step is skipped. It is only safe to set it to false when nothing has changed since the last update (i.e. nothing moved, no new objects created).

Ogre will assert if built in Debug mode if this value is set to false when it shouldn't be.

See https://ogrecave.github.io/ogre-next/api/2.2/ _ogre20_changes.html::AssersionCachedOutOfDate for more info

Returns
A vector of intersection results

Implemented in BaseRayQuery< T >, BaseRayQuery< Ogre2Object >, BaseRayQuery< OgreObject >, OgreRayQuery, and Ogre2RayQuery.

◆ Direction()

virtual math::Vector3d Direction ( ) const
pure virtual

Get ray direction.

Returns
Ray direction.

Implemented in BaseRayQuery< T >, BaseRayQuery< Ogre2Object >, and BaseRayQuery< OgreObject >.

◆ Origin()

virtual math::Vector3d Origin ( ) const
pure virtual

Get ray origin.

Returns
Ray origin

Implemented in BaseRayQuery< T >, BaseRayQuery< Ogre2Object >, and BaseRayQuery< OgreObject >.

◆ SetDirection()

virtual void SetDirection ( const math::Vector3d _dir)
pure virtual

Set ray direction.

Parameters
[in]_dirRay origin

Implemented in BaseRayQuery< T >, BaseRayQuery< Ogre2Object >, and BaseRayQuery< OgreObject >.

◆ SetFromCamera() [1/2]

virtual void SetFromCamera ( const CameraPtr _camera,
const math::Vector2d _coord 
)
pure virtual

Create the ray query from camera.

Parameters
[in]_cameraCamera to construct ray
[in]_coordnormalized device coords [-1, +1]

Implemented in BaseRayQuery< T >, BaseRayQuery< Ogre2Object >, BaseRayQuery< OgreObject >, OgreRayQuery, and Ogre2RayQuery.

◆ SetFromCamera() [2/2]

virtual void SetFromCamera ( const WideAngleCameraPtr _camera,
uint32_t  _faceIdx,
const math::Vector2d _coord 
)
pure virtual

Create the ray query from WideAngleCamera.

Parameters
[in]_cameraCamera to construct ray
[in]_faceIdxIn range [0; 6)
  • 0 = +X
  • 1 = -X
  • 2 = +Y
  • 3 = -Y
  • 4 = +Z
  • 5 = -Z
[in]_coordnormalized device coords [-1, +1]

Implemented in OgreRayQuery, and Ogre2RayQuery.

◆ SetOrigin()

virtual void SetOrigin ( const math::Vector3d _origin)
pure virtual

Set ray origin.

Parameters
[in]_originRay origin

Implemented in BaseRayQuery< T >, BaseRayQuery< Ogre2Object >, and BaseRayQuery< OgreObject >.

◆ SetPreferGpu()

virtual void SetPreferGpu ( bool  _preferGpu)
pure virtual

If possible & supported (and user called SetFromCamera()) will use the GPU to perform the ray query. Triangle-level accurate.

Remarks
It's not guaranteed the GPU will be used. See UsesGpu()
Using the GPU is not necessarily faster.
Parameters
[in]_preferGpuTrue to use the GPU if available & possible. False to never use the GPU.

Implemented in BaseRayQuery< T >, BaseRayQuery< Ogre2Object >, BaseRayQuery< OgreObject >, and Ogre2RayQuery.

◆ UsesGpu()

virtual bool UsesGpu ( ) const
pure virtual

Returns true if the GPU will be used for the next ClosestPoint() call.

Remarks
The thread ID is important. Calling this value from different threads may result in different return values.
Returns
True if next ClosestPoint() call will use the GPU.

Implemented in BaseRayQuery< T >, BaseRayQuery< Ogre2Object >, BaseRayQuery< OgreObject >, and Ogre2RayQuery.


The documentation for this class was generated from the following file: