Ray Tracer Common Project
Image rendering program based on the ray tracing technique.
sphere.hpp
1 
15 #pragma once
16 
17 #include "geometry.hpp"
18 
19 namespace rt{
20 
24 class Sphere : public Geometry{
25 public:
30  Sphere(double r);
36  Sphere(const vector & pos, double r);
37 
41  double ray() const;
45  void setRay(double r);
46 
51  vector normal(const vector &) const;
52 
57  vector tangent(const vector &) const;
58 
63  virtual vector uv(const element &) const;
64 
70  virtual std::vector<hit> hits(const euclidian &) const;
71 
72 private:
73  double _r;
74 };
75 
76 }
vector tangent(const vector &) const
Compute a tangent of the sphere from a local position.
Definition: sphere.cpp:22
Sphere(double r)
Make a new sphere at .
Definition: sphere.cpp:14
virtual std::vector< hit > hits(const euclidian &) const
Compute hits between the sphere and an euclidian.
Definition: sphere.cpp:61
Definition: bitmap.cpp:4
3D vector
Definition: vector.hpp:28
Geometric entity.
Definition: geometry.hpp:39
Geometric surface element unit.
Definition: element.hpp:43
void setRay(double r)
Set the ray of the sphere.
Definition: sphere.cpp:35
virtual vector uv(const element &) const
UV-map a surface element on the sphere.
Definition: sphere.cpp:84
vector normal(const vector &) const
Compute a normal of the sphere from a local position.
Definition: sphere.cpp:18
Localised vector class.
Definition: euclidian.hpp:27
Geometric sphere.
Definition: sphere.hpp:24
double ray() const
The ray of the sphere.
Definition: sphere.cpp:31