|
Path Tracer
|
A sphere described by its center and its radius. More...
#include <Sphere.h>
Public Member Functions | |
| Sphere () | |
| Default constructor. More... | |
| Sphere (const DoubleVec3D ¢er, double radius, Material *material) | |
| Main constructor. More... | |
| Sphere (const Sphere &sphere) | |
| Copy constructor. More... | |
| double | getRadius () const |
| Getter for the radius. More... | |
| DoubleVec3D | getCenter () const |
| Getter for the center. More... | |
| void | setCenter (const DoubleVec3D ¢er) |
| Setter for the center. More... | |
| void | setRadius (double radius) |
| Setter for the radius. More... | |
| void | computeArea () |
| Computes this sphere's area. More... | |
| Object3D * | deepCopy () const |
| Makes a deep copy of this object. More... | |
| double | smallestPositiveIntersection (const Ray &ray) const |
| Computes the smallest positive intersection between the ray and this object. More... | |
| DoubleUnitVec3D | getNormal (const DoubleVec3D &point) const |
| Computes the normal at a point on the object. More... | |
| DoubleVec3D | getRandomPoint () const |
| Computes a random point on the object. More... | |
| DoubleVec3D | getMinCoord () const |
| Returns the minimum coordinate of a cuboid containing this object. More... | |
| DoubleVec3D | getMaxCoord () const |
| Returns the maximum coordinate of a cuboid containing this object. More... | |
| std::ostream & | getDescription (std::ostream &stream) const |
| Returns this object's description. More... | |
| std::string | getType () const |
| Returns this object type. More... | |
| json | getLocationJson () const |
| Converts this objects's location to json. More... | |
| void | setLocationJson (const json &j) |
| Sets this object's location according to json. More... | |
Public Member Functions inherited from Object3D | |
| Object3D () | |
| Default constructor. More... | |
| Object3D (Material *material) | |
| Main constructor. More... | |
| Object3D (const Object3D &obj) | |
| Copy constructor. More... | |
| ~Object3D () | |
| Destructor. More... | |
| Material * | getMaterial () const |
| Getter for the Material. More... | |
| double | getArea () const |
| Getter for this object's area. More... | |
| void | setMaterial (Material *material) |
| Setter for the Material. More... | |
| Object3D & | operator= (const Object3D &otherObject) |
| Assignment operator. More... | |
Additional Inherited Members | |
Protected Attributes inherited from Object3D | |
| double | area |
| Stores the area of this object. More... | |
A sphere described by its center and its radius.
| Sphere::Sphere | ( | ) |
Default constructor.
Calls Object3D::Object3D(), then sets the center at (0, 0, 0) and the radius at 1.
| Sphere::Sphere | ( | const DoubleVec3D & | center, |
| double | radius, | ||
| Material * | material | ||
| ) |
Main constructor.
| center | The center of this sphere. |
| radius | The radius of this sphere. |
| material | A pointer to the material of this sphere. |
| Sphere::Sphere | ( | const Sphere & | sphere | ) |
Copy constructor.
| sphere | The sphere that will be copied. |
|
virtual |
Computes this sphere's area.
Modifies Object3D::area. It uses the formula A = 4*pi*radius*radius.
Implements Object3D.
|
virtual |
Makes a deep copy of this object.
Implements Object3D.
|
virtual |
|
virtual |
Returns this object's description.
| stream | The current stream. |
Implements Object3D.
|
virtual |
Converts this objects's location to json.
Implements Object3D.
|
virtual |
Returns the maximum coordinate of a cuboid containing this object.
This is computed using the following formula: center + DoubleVec3D(radius).
Implements Object3D.
|
virtual |
Returns the minimum coordinate of a cuboid containing this object.
This is computed using the following formula: center - DoubleVec3D(radius).
Implements Object3D.
|
virtual |
Computes the normal at a point on the object.
| point | The point on the object at which we want to compute the normal. |
Implements Object3D.
| double Sphere::getRadius | ( | ) | const |
Getter for the radius.
|
virtual |
Computes a random point on the object.
Every point has the same probability to show up.
Implements Object3D.
|
virtual |
| void Sphere::setCenter | ( | const DoubleVec3D & | center | ) |
Setter for the center.
Calls Sphere::computeArea().
| center | The new center of this sphere. |
|
virtual |
| void Sphere::setRadius | ( | double | radius | ) |
Setter for the radius.
Calls Sphere::computeArea().
| radius | The new radius of this sphere. |
|
virtual |
Computes the smallest positive intersection between the ray and this object.
| ray | The ray with wich we want to compute the intersection. |
Implements Object3D.