cpe::sphere Class Reference

Object3d of type Sphere (center+radius). Analytically compute intersection with a ray. More...

+ Inheritance diagram for cpe::sphere:
+ Collaboration diagram for cpe::sphere:

Public Member Functions

 sphere (const vec3 &center=vec3(), float radius=1.0)
 direct constructor (center+radius) More...
 
virtual ~sphere ()
 desctructor More...
 
double radius () const
 get radius More...
 
const vec3center () const
 get center More...
 
virtual bool intersect (const ray &ray_data, intersection &intersection_data) const
 Analytic intersection between a ray and the sphere. More...
 
- Public Member Functions inherited from cpe::object3d
 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...
 

Detailed Description

Object3d of type Sphere (center+radius). Analytically compute intersection with a ray.

Constructor & Destructor Documentation

cpe::sphere::sphere ( const vec3 center = vec3(),
float  radius = 1.0 
)

direct constructor (center+radius)

cpe::sphere::~sphere ( )
virtual

desctructor

Member Function Documentation

const vec3 & cpe::sphere::center ( ) const

get center

References x0.

bool cpe::sphere::intersect ( const ray ray_data,
intersection intersection_data 
) const
virtual

Analytic intersection between a ray and the sphere.

Implements cpe::object3d.

References cpe::vec3::dot(), cpe::ray::u, cpe::ray::x0, and x0.

+ Here is the call graph for this function:

double cpe::sphere::radius ( ) const

get radius

References r.

Member Data Documentation

float cpe::sphere::r
private

internal radius of the sphere

Referenced by radius().

vec3 cpe::sphere::x0
private

internal center of the sphere

Referenced by center(), and intersect().


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