Main Page | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

Sphere Class Reference

A basic Sphere primitive. More...

#include <surfaces/Sphere.h>

Inheritance diagram for Sphere:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Sphere (const Vector3 &c, double r, const Vector3 &u, const Vector3 &v, const Vector3 &w, SurfaceShader *sshader, LightShader *lshader)
bool hit (Ray &r, HitRecord &rec, Context &context) const
bool shadowHit (Ray &r, Context &context) const
BBox boundingBox (double time0, double time1) const
bool overlapsBox (const BBox &box) const
bool randomPoint (Vector3 &on_light, Context &context) const
bool randomDirection (const HitRecord &rec, Context &context, Vector3 &w_in, double &pdf) const
double pdfDirection (const Vector3 &w_in, const HitRecord &rec, Context &context) const

Detailed Description

A basic Sphere primitive.


Member Function Documentation

bool Sphere::hit Ray r,
HitRecord rec,
Context context
const [virtual]
 

Intersect given ray with the surface.

Parameters:
[in,out] r Ray to be intersected.
[in,out] rec Struct for passed back shading geometry.
[in,out] context Rendering context.
Returns:
Returns true if a new closest intersection has been found.

Implements Surface.

bool Sphere::shadowHit Ray r,
Context context
const [virtual]
 

Intersect without visibility ordering or shading geometry.

Parameters:
[in,out] r Ray to be intersected.
[in,out] context Rendering context.
Returns:
Returns true if a valid intersection is found.

Reimplemented from Surface.

BBox Sphere::boundingBox double  time0,
double  time1
const [virtual]
 

Calculate the bounding box of the surface.

Parameters:
[in] time0 Minimum of time interval being sampled.
[in] time1 Maximum of time interval being sampled.
Returns:
The bounding box of the object in the interval [time0, time1).

Implements Surface.

bool Sphere::overlapsBox const BBox box  )  const [virtual]
 

Determine if this surface overlaps the input axis aligned box.

Parameters:
[in] box Bounding box to test against.
Returns:
False if the surface definitely does not overlap the box.

Implements Surface.

bool Sphere::randomPoint Vector3 on_light,
Context context
const [virtual]
 

Randomly sample a point on the surface.

Parameters:
[out] on_light The generated sample point.
[in] context Contains seeds for sampling.
Returns:
True if the sample was generated.

Reimplemented from Surface.

bool Sphere::randomDirection const HitRecord rec,
Context context,
Vector3 w_in,
double &  pdf
const [virtual]
 

Choose direction with uniform probability within cone subtended by light as seen from rec.p. This means $q(w) = 1/solid-angle$ .
For $\theta$ , $p(\theta) = k*sin(theta)$ .
$P(\theta) = \int_0^{\theta_{max}} \sin$ .
Then $\xi = k(1-\cos(\theta))$ , so $k=1/(1-\cos(\theta_{max}))$
$1 -\cos(\theta) = \xi(1-\cos(\theta_{max})$ and finally:
$\cos(\theta) = 1 - \xi(1-\cos(\theta_{max}))$

Reimplemented from Surface.

double Sphere::pdfDirection const Vector3 w_in,
const HitRecord rec,
Context context
const [virtual]
 

Evalute pdf for the given direction.

Parameters:
[in] w_in The direction from hit point to the surface sampled.
[in] rec The record of the hit point being shaded.
[in] context The rendering context.
Returns:
Evaluation of the pdf for the given direction.

Reimplemented from Surface.


The documentation for this class was generated from the following files:
Generated on Wed Jul 20 16:15:28 2005 for galileo by  doxygen 1.4.3