73 bool IntersectMesh(
const std::vector<float> &vertices,
const std::vector<unsigned int> &indices,
float &t)
const;
83 bool IntersectMesh(
const std::vector<float> &vertices,
const std::vector<unsigned int> &indices,
const Mat4 &transform,
float &t)
const;
106 const Vec3 &linePoint,
const Vec3 &lineDirection);
117 const Vec3 &segmentStart,
const Vec3 &segmentEnd);
4x4 Matrix structure for 3D transformations and projections.
Definition Mat4.h:16
Represents a ray in 3D space with an origin and direction.
Definition Ray.h:15
Vec3 GetPoint(float t) const
Gets a point along the ray at parameter t.
Definition Ray.cpp:27
Ray()
Default constructor - creates a ray at origin pointing in positive Z direction.
Definition Ray.cpp:8
Vec3 GetOrigin() const
Gets the origin of the ray.
Definition Ray.cpp:17
Vec3 origin
The starting point of the ray.
Definition Ray.h:16
Vec3 direction
The normalized direction vector of the ray.
Definition Ray.h:17
bool IntersectTriangle(const Vec3 &v0, const Vec3 &v1, const Vec3 &v2, float &t) const
Tests intersection with a triangle using the Mรถller-Trumbore algorithm.
Definition Ray.cpp:95
Vec3 GetDirection() const
Gets the direction of the ray.
Definition Ray.cpp:22
bool IntersectSphere(const Vec3 ¢er, float radius, float &t) const
Tests intersection with a sphere.
Definition Ray.cpp:32
bool IntersectAABB(const Vec3 &minBounds, const Vec3 &maxBounds, float &t) const
Tests intersection with an axis-aligned bounding box.
Definition Ray.cpp:58
bool IntersectMesh(const std::vector< float > &vertices, const std::vector< unsigned int > &indices, float &t) const
Tests intersection with a mesh by testing all triangles.
Definition Ray.cpp:126
static Vec3 ClosestPointOnLine(const Vec3 &rayOrigin, const Vec3 &linePoint, const Vec3 &lineDirection)
Calculate the closest point on a line to a ray.
static float DistanceToLineSegment(const Vec3 &rayOrigin, const Vec3 &rayDirection, const Vec3 &segmentStart, const Vec3 &segmentEnd)
Calculate the distance from a ray to a line segment.