Object3d of type Sphere (center+radius). Analytically compute intersection with a ray. More...
Public Member Functions | |
sphere (const vec3 ¢er=vec3(), float radius=1.0) | |
direct constructor (center+radius) More... | |
virtual | ~sphere () |
desctructor More... | |
double | radius () const |
get radius More... | |
const vec3 & | center () const |
get center More... | |
virtual bool | intersect (const ray &ray_data, intersection &intersection_data) const |
Analytic intersection between a ray and the sphere. More... | |
![]() | |
object3d () | |
empty constructor More... | |
virtual | ~object3d () |
destructor More... | |
Private Attributes | |
vec3 | x0 |
internal center of the sphere More... | |
float | r |
internal radius of the sphere More... | |
Object3d of type Sphere (center+radius). Analytically compute intersection with a ray.
direct constructor (center+radius)
|
virtual |
desctructor
|
virtual |
Analytic intersection between a ray and the sphere.
Implements cpe::object3d.
References cpe::vec3::dot(), cpe::ray::u, cpe::ray::x0, and x0.
double cpe::sphere::radius | ( | ) | const |
get radius
References r.
|
private |
internal radius of the sphere
Referenced by radius().
|
private |
internal center of the sphere
Referenced by center(), and intersect().