Raytracer
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
Raytracer::Utils::BVHNode Class Reference
Inheritance diagram for Raytracer::Utils::BVHNode:
Raytracer::Interfaces::IHittable

Public Member Functions

 BVHNode (Core::Scene list)
 Construct a new BVHNode object.
 
 BVHNode (std::vector< std::shared_ptr< Interfaces::IHittable > > &objects, size_t start, size_t end)
 
bool hit (const Core::Ray &ray, Interval interval, Core::Payload &payload) const override
 Check if the ray hits the BVHNode.
 
AxisAlignedBBox boundingBox () const override
 Get the bounding box of the BVHNode.
 

Static Public Member Functions

static bool boxCompare (const std::shared_ptr< Interfaces::IHittable > &a, const std::shared_ptr< Interfaces::IHittable > &b, int axis)
 Compare two objects based on the given axis.
 
static bool boxXCompare (const std::shared_ptr< Interfaces::IHittable > &a, const std::shared_ptr< Interfaces::IHittable > &b)
 Compare two objects based on the x-axis.
 
static bool boxYCompare (const std::shared_ptr< Interfaces::IHittable > &a, const std::shared_ptr< Interfaces::IHittable > &b)
 Compare two objects based on the y-axis.
 
static bool boxZCompare (const std::shared_ptr< Interfaces::IHittable > &a, const std::shared_ptr< Interfaces::IHittable > &b)
 Compare two objects based on the z-axis.
 

Constructor & Destructor Documentation

◆ BVHNode()

Raytracer::Utils::BVHNode::BVHNode ( Core::Scene list)

Construct a new BVHNode object.

This function constructs a new BVHNode object with the given list of objects. The BVHNode is a bounding volume hierarchy node that represents a node in a BVH tree. The BVH tree is a binary tree that is used to accelerate ray tracing. The BVHNode is constructed from the given list of objects.

Parameters
listThe list of objects.
Returns
A new BVHNode object.

Member Function Documentation

◆ boundingBox()

Raytracer::Utils::AxisAlignedBBox Raytracer::Utils::BVHNode::boundingBox ( ) const
overridevirtual

Get the bounding box of the BVHNode.

This function returns the bounding box of the BVHNode.

Returns
The bounding box of the BVHNode.

Implements Raytracer::Interfaces::IHittable.

◆ boxCompare()

bool Raytracer::Utils::BVHNode::boxCompare ( const std::shared_ptr< Interfaces::IHittable > & a,
const std::shared_ptr< Interfaces::IHittable > & b,
int axis )
static

Compare two objects based on the given axis.

This function compares two objects based on the given axis. The function returns true if the first object is less than the second object based on the given axis. The function returns false otherwise.

Parameters
aThe first object.
bThe second object.
axisThe axis to compare the objects on.
Returns
true if the first object is less than the second object based on the given axis, false otherwise.

◆ boxXCompare()

bool Raytracer::Utils::BVHNode::boxXCompare ( const std::shared_ptr< Interfaces::IHittable > & a,
const std::shared_ptr< Interfaces::IHittable > & b )
static

Compare two objects based on the x-axis.

This function compares two objects based on the x-axis. The function returns true if the first object is less than the second object based on the x-axis. The function returns false otherwise.

Parameters
aThe first object.
bThe second object.
Returns
true if the first object is less than the second object based on the x-axis, false otherwise.

◆ boxYCompare()

bool Raytracer::Utils::BVHNode::boxYCompare ( const std::shared_ptr< Interfaces::IHittable > & a,
const std::shared_ptr< Interfaces::IHittable > & b )
static

Compare two objects based on the y-axis.

This function compares two objects based on the y-axis. The function returns true if the first object is less than the second object based on the y-axis. The function returns false otherwise.

Parameters
aThe first object.
bThe second object.
Returns
true if the first object is less than the second object based on the y-axis, false otherwise.

◆ boxZCompare()

bool Raytracer::Utils::BVHNode::boxZCompare ( const std::shared_ptr< Interfaces::IHittable > & a,
const std::shared_ptr< Interfaces::IHittable > & b )
static

Compare two objects based on the z-axis.

This function compares two objects based on the z-axis. The function returns true if the first object is less than the second object based on the z-axis. The function returns false otherwise.

Parameters
aThe first object.
bThe second object.
Returns
true if the first object is less than the second object based on the z-axis, false otherwise.

◆ hit()

bool Raytracer::Utils::BVHNode::hit ( const Core::Ray & ray,
Interval interval,
Core::Payload & payload ) const
overridevirtual

Check if the ray hits the BVHNode.

This function checks if the ray hits the BVHNode. The function returns true if the ray hits the BVHNode. The function returns false if the ray does not hit the BVHNode. The function updates the payload with the hit information.

Parameters
rayThe ray to check for hits.
intervalThe interval to check for hits.
payloadThe payload to update with the hit information.
Returns
true if the ray hits the BVHNode, false otherwise.

Implements Raytracer::Interfaces::IHittable.


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