Cumulia Illustrator Rendering Engine v1.1.0
A Rendering engine for industrial CAD/CAE model and optimized for greatest performance
 
Loading...
Searching...
No Matches
cil::Ray Class Reference

The Ray class inherits from the Tuple class, specilizing the templated parameter to float for element type. More...

#include <ray.h>

Inheritance diagram for cil::Ray:
cil::Tuple< float > cil::Variant

Public Member Functions

 Ray ()
 Constructs a Ray object, all elements initialized to 0.
 
 Ray (const Ray &other)
 
 Ray (const Vector3f &origin, const Vector3f &normal)
 Constructs a Ray object using the origin point and the direction.
 
const float & operator[] (int index) const
 Provides read-only access to the element at a specific index(position) within the Ray object.
 
float & operator[] (int index)
 Provides read-write access to the element at a specific index(position) within the Ray object.
 
void set (const Vector3f &origin, const Vector3f &direction)
 Sets the origin point and direction of the Ray object.
 
Vector3f origin () const
 Gets a Vector3f object that is the origin of the current Ray.
 
void setOrigin (const Vector3f &origin)
 Sets the origin of the current Ray.
 
Vector3f direction () const
 Gets a Vector3f object that is the direction of the current Ray.
 
void setDirection (const Vector3f &direction)
 Sets the direction ot the current Ray.
 
Vector3f project (const Vector3f &point) const
 Gets the projected point of the other point on the current Ray.
 
void transform (const Matrix4f &other)
 Transform the current Ray object using the other transformation matrix.
 
bool triangleIntersect (const Vector3f &v1, const Vector3f &v2, const Vector3f &v3, Vector3f *intersectionPoint=nullptr, Vector3f *intersectionPointNormal=nullptr) const
 Returns true if the ray intersects the triangle.
 
bool quadIntersect (const Vector3f &v1, const Vector3f &v2, const Vector3f &v3, const Vector3f &v4, Vector3f *intersectionPoint=nullptr) const
 Returns true if the ray intersects the quad.
 
bool lineIntersect (const Vector3f &v1, const Vector3f &v2, float radius, Vector3f *intersectionPoint=nullptr) const
 Returns true if the ray intersects the line.
 
bool pointIntersect (const Vector3f &v1, float radius) const
 Returns true if the ray intersects the point.
 
bool boxIntersect (const BoundingBox &box, Vector3f *intersectionPoint=nullptr) const
 Returns true if the ray intersects the bounding box.
 
bool planeIntersect (const Plane &plane, Vector3f *intersectionPoint=nullptr) const
 Returns true if the ray intersects the plane.
 
- Public Member Functions inherited from cil::Tuple< float >
 Tuple (int size)
 Constructs a Tuple object with a specified number of elements, and initialize all elements to 0.
 
virtual ~Tuple ()
 
int size () const
 Gets the number of elements of the Tuple.
 
float * data ()
 Gets the data array of the Tuple.
 
const float * data () const
 Gets the data array of the Tuple, and the data could not be modified upon which this function is called.
 
void setData (const float *data)
 Sets the data array of the Variant.
 
Tuple< float > & operator= (const Tuple &other)
 Copys the data of another Tuple to the one on which the operator is invoked.
 
bool operator== (const Tuple &other) const
 Compares the Tuple with another one, and returns true if they are equal, otherwise returns false.
 
bool operator!= (const Tuple &other) const
 Compares the Tuple with another one, and returns false if they are equal, otherwise returns true.
 
- Public Member Functions inherited from cil::Variant
 Variant ()
 
virtual ~Variant ()
 
const std::string & type () const
 

Additional Inherited Members

- Protected Attributes inherited from cil::Tuple< float >
float * m_data
 The data array of the Tuple.
 
int m_size
 The number of elements that the data array of the Tuple holds.
 
- Protected Attributes inherited from cil::Variant
std::string m_type
 

Detailed Description

The Ray class inherits from the Tuple class, specilizing the templated parameter to float for element type.

The Ray object is represented in 3D space using a origin point(the first three elements) and a direction(the last three elements), so it stores six elements.

Constructor & Destructor Documentation

◆ Ray() [1/3]

cil::Ray::Ray ( )

Constructs a Ray object, all elements initialized to 0.

◆ Ray() [2/3]

cil::Ray::Ray ( const Ray & other)

◆ Ray() [3/3]

cil::Ray::Ray ( const Vector3f & origin,
const Vector3f & normal )

Constructs a Ray object using the origin point and the direction.

Member Function Documentation

◆ boxIntersect()

bool cil::Ray::boxIntersect ( const BoundingBox & box,
Vector3f * intersectionPoint = nullptr ) const

Returns true if the ray intersects the bounding box.

◆ direction()

Vector3f cil::Ray::direction ( ) const

Gets a Vector3f object that is the direction of the current Ray.

◆ lineIntersect()

bool cil::Ray::lineIntersect ( const Vector3f & v1,
const Vector3f & v2,
float radius,
Vector3f * intersectionPoint = nullptr ) const

Returns true if the ray intersects the line.

◆ operator[]() [1/2]

float & cil::Ray::operator[] ( int index)

Provides read-write access to the element at a specific index(position) within the Ray object.

◆ operator[]() [2/2]

const float & cil::Ray::operator[] ( int index) const

Provides read-only access to the element at a specific index(position) within the Ray object.

◆ origin()

Vector3f cil::Ray::origin ( ) const

Gets a Vector3f object that is the origin of the current Ray.

◆ planeIntersect()

bool cil::Ray::planeIntersect ( const Plane & plane,
Vector3f * intersectionPoint = nullptr ) const

Returns true if the ray intersects the plane.

◆ pointIntersect()

bool cil::Ray::pointIntersect ( const Vector3f & v1,
float radius ) const

Returns true if the ray intersects the point.

◆ project()

Vector3f cil::Ray::project ( const Vector3f & point) const

Gets the projected point of the other point on the current Ray.

◆ quadIntersect()

bool cil::Ray::quadIntersect ( const Vector3f & v1,
const Vector3f & v2,
const Vector3f & v3,
const Vector3f & v4,
Vector3f * intersectionPoint = nullptr ) const

Returns true if the ray intersects the quad.

◆ set()

void cil::Ray::set ( const Vector3f & origin,
const Vector3f & direction )

Sets the origin point and direction of the Ray object.

◆ setDirection()

void cil::Ray::setDirection ( const Vector3f & direction)

Sets the direction ot the current Ray.

◆ setOrigin()

void cil::Ray::setOrigin ( const Vector3f & origin)

Sets the origin of the current Ray.

◆ transform()

void cil::Ray::transform ( const Matrix4f & other)

Transform the current Ray object using the other transformation matrix.

◆ triangleIntersect()

bool cil::Ray::triangleIntersect ( const Vector3f & v1,
const Vector3f & v2,
const Vector3f & v3,
Vector3f * intersectionPoint = nullptr,
Vector3f * intersectionPointNormal = nullptr ) const

Returns true if the ray intersects the triangle.