Castor3D  ..
Public Member Functions | Public Attributes | List of all members
Castor3D::Ray Class Reference

Ray representation. More...

Public Member Functions

C3D_API Ray (Castor::Point2i const &p_ptPoint, Camera const &p_camera)
 Constructor from mouse coordinates and a viewport. More...
 
C3D_API Ray (int p_x, int p_y, Camera const &p_camera)
 Constructor from mouse coordinates and a viewport. More...
 
C3D_API Ray (Castor::Point3r const &p_ptOrigin, Castor::Point3r const &p_ptDirection)
 Constructor from mouse coordinates and a viewport. More...
 
C3D_API Ray (Ray const &p_copy)
 Copy constructor. More...
 
C3D_API Ray (Ray &&p_copy)
 Copy constructor. More...
 
C3D_API ~Ray ()
 Destructor. More...
 
C3D_API real Intersects (Castor::Point3r const &p_pt1, Castor::Point3r const &p_pt2, Castor::Point3r const &p_pt3)
 Tells if the ray intersects the given triangle of vertices. More...
 
C3D_API real Intersects (Face const &p_face, Submesh const &p_submesh)
 Tells if the ray intersects the given face. More...
 
C3D_API real Intersects (Castor::Point3r const &p_point)
 Tells if the vertex is on the ray. More...
 
C3D_API real Intersects (Castor::CubeBox const &p_box)
 Tells if the ray intersects the given Combo box. More...
 
C3D_API real Intersects (Castor::SphereBox const &p_sphere)
 Tells if the ray intersects the given Sphere. More...
 
C3D_API real Intersects (GeometrySPtr p_pGeometry, FaceSPtr *p_nearestFace, SubmeshSPtr *p_nearestSubmesh)
 Tells if the ray intersects the given Geometry. More...
 
C3D_API bool ProjectVertex (Castor::Point3r const &p_point, Castor::Point3r &p_result)
 Projects the given vertex on the ray. More...
 

Public Attributes

Castor::Point3r m_ptOrigin
 The ray origin. More...
 
Castor::Point3r m_ptDirection
 The ray direction. More...
 

Detailed Description

Ray representation.

A ray is an origin and a direction in 3D

Author
Sylvain DOREMUS
Date
14/02/2010

Constructor & Destructor Documentation

◆ Ray() [1/5]

C3D_API Castor3D::Ray::Ray ( Castor::Point2i const &  p_ptPoint,
Camera const &  p_camera 
)

Constructor from mouse coordinates and a viewport.

Parameters
[in]p_ptPointThe mouse coordinates
[in]p_cameraThe camera from which to retrieve the ray

◆ Ray() [2/5]

C3D_API Castor3D::Ray::Ray ( int  p_x,
int  p_y,
Camera const &  p_camera 
)

Constructor from mouse coordinates and a viewport.

Parameters
[in]p_xThe mouse x
[in]p_yThe mouse y
[in]p_cameraThe camera from which to retrieve the ray

◆ Ray() [3/5]

C3D_API Castor3D::Ray::Ray ( Castor::Point3r const &  p_ptOrigin,
Castor::Point3r const &  p_ptDirection 
)

Constructor from mouse coordinates and a viewport.

Parameters
[in]p_ptOriginThe origin of the ray
[in]p_ptDirectionThe The direction of the ray

◆ Ray() [4/5]

C3D_API Castor3D::Ray::Ray ( Ray const &  p_copy)

Copy constructor.

Parameters
[in]p_copyThe object to copy

◆ Ray() [5/5]

C3D_API Castor3D::Ray::Ray ( Ray &&  p_copy)

Copy constructor.

Parameters
[in]p_copyThe object to copy

◆ ~Ray()

C3D_API Castor3D::Ray::~Ray ( )

Destructor.

Member Function Documentation

◆ Intersects() [1/6]

C3D_API real Castor3D::Ray::Intersects ( Castor::Point3r const &  p_pt1,
Castor::Point3r const &  p_pt2,
Castor::Point3r const &  p_pt3 
)

Tells if the ray intersects the given triangle of vertices.

Parameters
[in]p_pt1The first triangle vertex
[in]p_pt2The second triangle vertex
[in]p_pt3The third triangle vertex
Returns
true if the ray intersects the triangle, false if not

◆ Intersects() [2/6]

C3D_API real Castor3D::Ray::Intersects ( Face const &  p_face,
Submesh const &  p_submesh 
)

Tells if the ray intersects the given face.

Parameters
[in]p_faceThe face to test
[in]p_submeshThe submesh holding the face
Returns
true if the ray intersects the face, false if not

◆ Intersects() [3/6]

C3D_API real Castor3D::Ray::Intersects ( Castor::Point3r const &  p_point)

Tells if the vertex is on the ray.

Parameters
[in]p_pointThe face to test
Returns
true if vertex is on the ray, false if not

◆ Intersects() [4/6]

C3D_API real Castor3D::Ray::Intersects ( Castor::CubeBox const &  p_box)

Tells if the ray intersects the given Combo box.

Parameters
[in]p_boxThe box to test
Returns
true if the ray intersects the face, false if not

◆ Intersects() [5/6]

C3D_API real Castor3D::Ray::Intersects ( Castor::SphereBox const &  p_sphere)

Tells if the ray intersects the given Sphere.

Parameters
[in]p_sphereThe sphere to test
Returns
true if the ray intersects the face, false if not

◆ Intersects() [6/6]

C3D_API real Castor3D::Ray::Intersects ( GeometrySPtr  p_pGeometry,
FaceSPtr *  p_nearestFace,
SubmeshSPtr *  p_nearestSubmesh 
)

Tells if the ray intersects the given Geometry.

Parameters
[in]p_pGeometryThe sphere to test
[out]p_nearestFaceThe intersected face
[out]p_nearestSubmeshThe intersected submesh
Returns
true if the ray intersects the face, false if not

◆ ProjectVertex()

C3D_API bool Castor3D::Ray::ProjectVertex ( Castor::Point3r const &  p_point,
Castor::Point3r &  p_result 
)

Projects the given vertex on the ray.

Parameters
[in]p_pointThe vertex we want to project
[out]p_resultThe projecion result
Returns
true if the vertex can be projected on the ray, false if not

Member Data Documentation

◆ m_ptDirection

Castor::Point3r Castor3D::Ray::m_ptDirection

The ray direction.

◆ m_ptOrigin

Castor::Point3r Castor3D::Ray::m_ptOrigin

The ray origin.


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