Ray Tracer  2020
Public Member Functions | List of all members
Plane Class Reference

Class for Plane objects. More...

#include <Plane.h>

Inheritance diagram for Plane:
Object

Public Member Functions

 Plane ()
 Plane default constructor. More...
 
 Plane (const Plane &plane)
 Plane copy constructor. More...
 
 ~Plane ()
 Plane destructor. More...
 
Planeoperator= (const Plane &plane)
 Plane assignment operator. More...
 
std::vector< RayIntersectionintersect (const Ray &ray) const
 Plane-Ray intersection computation. More...
 

Additional Inherited Members

- Public Attributes inherited from Object
Transform transform
 A 3D transformation to apply to this Object. More...
 
Material material
 The colour and reflectance properties of the Object. More...
 
- Protected Member Functions inherited from Object
 Object ()
 Object default constructor. More...
 
 Object (const Object &object)
 Object copy constructor. More...
 
virtual ~Object ()
 Object destructor. More...
 
Objectoperator= (const Object &object)
 Object assignment operator. More...
 

Detailed Description

Class for Plane objects.

This class provides an Object which is a plane centred at the origin, extending \(\pm 1\) units along the \(X\) and \(Y\) axes, as shown below:

Note that the Cube provided in the skeleton code is not complete and returns no RayIntersections from intersect(). This method needs to be implemented correctly as part of the labs/assignment.

Constructor & Destructor Documentation

◆ Plane() [1/2]

Plane::Plane ( )

Plane default constructor.

A newly constructed Plane is centred at the origin, and extends \(\pm 1\) units along the \(X\) and \(Y\) axes. It may be moved, rotated, and scaled through its transform member.

◆ Plane() [2/2]

Plane::Plane ( const Plane plane)

Plane copy constructor.

Parameters
planeThe Plane to copy.

◆ ~Plane()

Plane::~Plane ( )

Plane destructor.

Member Function Documentation

◆ intersect()

std::vector< RayIntersection > Plane::intersect ( const Ray ray) const
virtual

Plane-Ray intersection computation.

Todo:
The Plane-Ray intersection needs to be implemented as part of the assignment.

The intersection of a Ray with a Plane comes down to determining when the \(Z\) component of the Ray is zero. If that lies within the bounds of the plane there is an intersection.

Parameters
rayThe Ray to intersect with this Sphere.
Returns
A list (std::vector) of intersections, which may be empty.

Implements Object.

◆ operator=()

Plane & Plane::operator= ( const Plane plane)

Plane assignment operator.

Parameters
planeThe Plane to assign to this.
Returns
A reference to this to allow for chaining of assignment.

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