RobinTrace
Public Member Functions | Public Attributes | Private Member Functions | List of all members
standard Class Reference

Standard shape specialization. More...

#include <standard.h>

Inheritance diagram for standard:
[legend]
Collaboration diagram for standard:
[legend]

Public Member Functions

 standard ()
 Default constructor. More...
 
 standard (double _c, double _k)
 Initialization constructor. More...
 
 standard (double _c)
 Sphere constructor. More...
 
virtual void intersect (ray &r) override
 Operate the intersection of ray r with standard shape. More...
 
virtual Vec3 normal (const ray &r) override
 Compute the normal of the standard shape at the current ray r position. More...
 

Public Attributes

double c
 Curvature. More...
 
double k
 Quadric constant. More...
 

Private Member Functions

virtual std::string print_str () const override
 Printer.
 

Detailed Description

Standard shape specialization.

Constructor & Destructor Documentation

◆ standard() [1/3]

standard::standard ( )

Default constructor.

The default initialization is to a plane surface,

  • \( c = 0 \)
  • \( k = 0 \)

◆ standard() [2/3]

standard::standard ( double  _c,
double  _k 
)

Initialization constructor.

Initializes the standard shape to curvature _c and quadric constant _k.

Parameters
_cInitial curvature of the standard shape.
_kInitial quadric constant of the standard shape.

◆ standard() [3/3]

standard::standard ( double  _c)

Sphere constructor.

Initialize a sphere of curvature _c.

Parameters
_cInitial sphere curvature.

Member Function Documentation

◆ intersect()

void standard::intersect ( ray r)
overridevirtual

Operate the intersection of ray r with standard shape.

Possible error case: no intersection found between ray and shape.

The exact definition of the standard shape is implicitely specified by this operation.

Implements shape.

◆ normal()

Vec3 standard::normal ( const ray r)
overridevirtual

Compute the normal of the standard shape at the current ray r position.

It is assumed this operation is applied where the normal vector can be computed, for instance after a successful intersection. No error cases are signaled by the normal computation.

Implements shape.

Member Data Documentation

◆ c

double standard::c

Curvature.

This is the reciprocal of the radius of curvature \(R\).

\[ c = \frac{1}{R} \]

The case \( c = 0 \) describes a plane.

◆ k

double standard::k

Quadric constant.

The type of quadric is specified by k. The cases are the following,

  • \( k < -1 \) Single sheet from a hyperboloid of revolution of two sheets.
  • \( k = -1 \) Circular paraboloid.
  • \( k > -1 \) Spheroid, with the case \( k=0 \) being a sphere.

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