Triangle class

An instance of a triangle for a given face in a mesh.

Base classes

class Surface
This is the abstract superclass for all surfaces.

Constructors, destructors, conversion operators

Triangle(const json& j)
Parse and construct a single triangle.
Triangle(const json& j, shared_ptr<const Mesh> mesh, uint32_t tri_number)
Construct a single triangle of an existing mesh.

Public functions

auto intersect(const Ray3f& ray, HitInfo& hit) const -> bool override
Ray-Surface intersection test.
auto bounds() const -> Box3f override
Return the surface's world-space AABB.
auto is_emissive() const -> bool override
Return whether or not this Surface's Material is emissive.

Function documentation

bool Triangle::intersect(const Ray3f& ray, HitInfo& hit) const override

Ray-Surface intersection test.

Parameters
ray A 3-dimensional ray data structure with minimum/maximum extent information
hit A detailed intersection record, which will be filled by the intersection query
Returns true if an intersection was found

Intersect a ray against this surface and return detailed intersection information.