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

Public Member Functions

 Cylinder (const Utils::Point3 &center, double radius, double height, std::shared_ptr< Interfaces::IMaterial > material)
 Construct a new Cylinder object.
 
virtual bool hit (const Core::Ray &ray, Utils::Interval interval, Core::Payload &payload) const override
 Check if the ray hits the cylinder.
 
virtual Utils::AxisAlignedBBox boundingBox () const override
 Get the bounding box of the cylinder.
 

Constructor & Destructor Documentation

◆ Cylinder()

Raytracer::Shapes::Cylinder::Cylinder ( const Utils::Point3 & center,
double radius,
double height,
std::shared_ptr< Interfaces::IMaterial > material )

Construct a new Cylinder object.

This function constructs a new Cylinder object with the given center, radius, height, and material. The cylinder is centered at the given center with the given radius, height, and material.

Parameters
centerThe center of the cylinder.
radiusThe radius of the cylinder.
heightThe height of the cylinder.
materialThe material of the cylinder.
Returns
A new Cylinder object.

Member Function Documentation

◆ boundingBox()

Raytracer::Utils::AxisAlignedBBox Raytracer::Shapes::Cylinder::boundingBox ( ) const
overridevirtual

Get the bounding box of the cylinder.

This function returns the bounding box of the cylinder.

Returns
The bounding box of the cylinder.

Implements Raytracer::Interfaces::IHittable.

◆ hit()

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

Check if the ray hits the cylinder.

This function checks if the ray hits the cylinder. The function returns true if the ray hits the cylinder. The function returns false if the ray does not hit the cylinder. 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 cylinder, false otherwise.

Implements Raytracer::Interfaces::IHittable.


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