Web Analytics Made Easy - Statcounter
Skip to content

Class SBDTypeRay#

ClassList > SBDTypeRay

This class implements a ray. More...

  • #include <SBDTypeRay.hpp>

Public Functions#

Type Name
SBDTypeRay ()
Constructs a ray with default values.
SBDTypeRay (const SBPosition3 & origin, const SBVector3 & direction)
Constructs a ray with the specified origin and direction.
const SBVector3 & getDirection () const
Returns the direction vector of the ray.
const SBPosition3 & getOrigin () const
Returns the origin point of the ray.
bool intersectionAABB (const SBIAPosition3 & aabb) const
Determines whether the ray intersects the specified axis-aligned bounding box (AABB).
bool intersectionAABB (const SBIAPosition3 & aabb, SBQuantity::length & distance) const
Determines whether the ray intersects the specified axis-aligned bounding box (AABB) and provides the distance to the intersection.
bool intersectionSphere (const SBPosition3 & center, const SBQuantity::length & radius) const
Determines whether the ray intersects a sphere defined by the given center and radius.
bool intersectionSphere (const SBPosition3 & center, const SBQuantity::length & radius, SBPosition3 & intersection) const
Determines whether the ray intersects a sphere and provides the intersection point.
bool isSerializable () const
Returns true __
void serialize (SBCSerializer * serializer, const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER) const
Serializes the ray.
void setDirection (const SBVector3 & direction)
Sets the direction vector of the ray.
void setOrigin (const SBPosition3 & origin)
Sets the origin point of the ray.
void unserialize (SBCSerializer * serializer, const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER)
Unserializes the ray.
virtual ~SBDTypeRay ()
Destroys the ray and releases allocated resources.

Protected Attributes#

Type Name
SBDTypeRayData * dataPointer
A pointer to the private data.

Detailed Description#

Short name: SBRay

Public Functions Documentation#

function SBDTypeRay [1/2]#

Constructs a ray with default values.

SBDTypeRay::SBDTypeRay () 

The ray's origin and direction are initialized to zero.


function SBDTypeRay [2/2]#

Constructs a ray with the specified origin and direction.

SBDTypeRay::SBDTypeRay (
    const SBPosition3 & origin,
    const SBVector3 & direction
) 

Parameters:

  • origin The origin point of the ray.
  • direction The direction vector of the ray.

function getDirection#

Returns the direction vector of the ray.

const SBVector3 & SBDTypeRay::getDirection () const

Returns:

A reference to the ray's direction vector.


function getOrigin#

Returns the origin point of the ray.

const SBPosition3 & SBDTypeRay::getOrigin () const

Returns:

A reference to the ray's origin.


function intersectionAABB [1/2]#

Determines whether the ray intersects the specified axis-aligned bounding box (AABB).

bool SBDTypeRay::intersectionAABB (
    const SBIAPosition3 & aabb
) const

Parameters:

  • aabb The AABB to test for intersection.

Returns:

true if the ray intersects the AABB; otherwise false.


function intersectionAABB [2/2]#

Determines whether the ray intersects the specified axis-aligned bounding box (AABB) and provides the distance to the intersection.

bool SBDTypeRay::intersectionAABB (
    const SBIAPosition3 & aabb,
    SBQuantity::length & distance
) const

Parameters:

  • aabb The AABB to test for intersection.
  • distance Output parameter that receives the distance from the ray origin to the intersection point if an intersection occurs.

Returns:

true if the ray intersects the AABB; otherwise false.


function intersectionSphere [1/2]#

Determines whether the ray intersects a sphere defined by the given center and radius.

bool SBDTypeRay::intersectionSphere (
    const SBPosition3 & center,
    const SBQuantity::length & radius
) const

Parameters:

  • center The center point of the sphere.
  • radius The radius of the sphere.

Returns:

true if the ray intersects the sphere; otherwise false.


function intersectionSphere [2/2]#

Determines whether the ray intersects a sphere and provides the intersection point.

bool SBDTypeRay::intersectionSphere (
    const SBPosition3 & center,
    const SBQuantity::length & radius,
    SBPosition3 & intersection
) const

Parameters:

  • center The center point of the sphere.
  • radius The radius of the sphere.
  • intersection Output parameter that receives the intersection point if an intersection occurs.

Returns:

true if the ray intersects the sphere; otherwise false.


function isSerializable#

Returns true __

bool SBDTypeRay::isSerializable () const

Returns true indicating the ray type supports serialization.

Returns:

true.


function serialize#

Serializes the ray.

void SBDTypeRay::serialize (
    SBCSerializer * serializer,
    const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER
) const

Serializes the ray to the given serializer using the specified SDK version number.

Parameters:

  • serializer The serializer to write the ray data to.
  • sdkVersionNumber The SDK version number to use for serialization. Defaults to SB_SDK_VERSION_NUMBER.

function setDirection#

Sets the direction vector of the ray.

void SBDTypeRay::setDirection (
    const SBVector3 & direction
) 

Parameters:

  • direction The new direction vector for the ray.

function setOrigin#

Sets the origin point of the ray.

void SBDTypeRay::setOrigin (
    const SBPosition3 & origin
) 

Parameters:

  • origin The new origin point for the ray.

function unserialize#

Unserializes the ray.

void SBDTypeRay::unserialize (
    SBCSerializer * serializer,
    const SBVersionNumber & sdkVersionNumber=SB_SDK_VERSION_NUMBER
) 

Deserializes the ray from the given serializer using the specified SDK version number.

Parameters:

  • serializer The serializer to read the ray data from.
  • sdkVersionNumber The SDK version number to use for deserialization. Defaults to SB_SDK_VERSION_NUMBER.

function ~SBDTypeRay#

Destroys the ray and releases allocated resources.

virtual SBDTypeRay::~SBDTypeRay () 


Protected Attributes Documentation#

variable dataPointer#

A pointer to the private data.

SBDTypeRayData* SBDTypeRay::dataPointer;