MobileRT  1.0
A multi platform C++ CPU progressive Ray Tracer.
MobileRT::Sphere Class Referencefinal

#include <Sphere.hpp>

Collaboration diagram for MobileRT::Sphere:
Collaboration graph

Public Member Functions

 Sphere ()=delete
 
 Sphere (const ::glm::vec3 &center, float radius, ::std::int32_t materialIndex)
 
 Sphere (const Sphere &sphere)=default
 
 Sphere (Sphere &&sphere) noexcept=default
 
 ~Sphere ()=default
 
Sphereoperator= (const Sphere &sphere)=default
 
Sphereoperator= (Sphere &&sphere) noexcept=default
 
Intersection intersect (Intersection intersection) const
 
AABB getAABB () const
 
bool intersect (const AABB &box) const
 

Private Member Functions

void checkArguments () const
 

Private Attributes

::glm::vec3 center_ {}
 
float sqRadius_ {}
 
::std::int32_t materialIndex_ {-1}
 

Detailed Description

A class which represents a sphere in the scene.

Constructor & Destructor Documentation

◆ Sphere() [1/4]

MobileRT::Sphere::Sphere ( )
explicitdelete

◆ Sphere() [2/4]

MobileRT::Sphere::Sphere ( const ::glm::vec3 &  center,
float  radius,
::std::int32_t  materialIndex 
)
explicit

◆ Sphere() [3/4]

MobileRT::Sphere::Sphere ( const Sphere sphere)
default

◆ Sphere() [4/4]

MobileRT::Sphere::Sphere ( Sphere &&  sphere)
defaultnoexcept

◆ ~Sphere()

MobileRT::Sphere::~Sphere ( )
default

Member Function Documentation

◆ checkArguments()

void Sphere::checkArguments ( ) const
private

Helper method which checks for invalid fields.

Here is the call graph for this function:

◆ getAABB()

AABB Sphere::getAABB ( ) const

Calculates the bounding box of the sphere.

Returns
The bounding box of the sphere.

◆ intersect() [1/2]

Intersection Sphere::intersect ( Intersection  intersection) const

Determines if a ray intersects this sphere or not and calculates the intersection point. The algorithm is based on this source .

Parameters
intersectionThe previous intersection of the ray in the scene.
Returns
The intersection point.
Here is the call graph for this function:

◆ intersect() [2/2]

bool Sphere::intersect ( const AABB box) const

Checks if a bounding box intersects the sphere or not.

Parameters
boxA bounding box.
Returns
Whether if the bounding box intersects the sphere or not.
Here is the call graph for this function:

◆ operator=() [1/2]

Sphere& MobileRT::Sphere::operator= ( const Sphere sphere)
default

◆ operator=() [2/2]

Sphere& MobileRT::Sphere::operator= ( Sphere &&  sphere)
defaultnoexcept

Member Data Documentation

◆ center_

::glm::vec3 MobileRT::Sphere::center_ {}
private

◆ materialIndex_

::std::int32_t MobileRT::Sphere::materialIndex_ {-1}
private

◆ sqRadius_

float MobileRT::Sphere::sqRadius_ {}
private

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