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

toxic::Sphere Class Reference

#include <sphere.h>

Inheritance diagram for toxic::Sphere:

toxic::IAreaLight toxic::IBoundedObject toxic::ILight toxic::IObject toxic::Basis List of all members.

Public Member Functions

 Sphere (const sheep::Matrix4 &m, const ISurfaceShader *surface_shader, IntersectionMask intersection_mask=INTERSECT_ALL_RAYS)
 m is the object space to world space transformation matrix.

virtual const sheep::AABB3GetAABB () const
virtual sheep::Real ComputeSurfaceArea () const
 Computes the surface area of this object.

virtual void EvaluateSurface (const sheep::Point2 &input, sheep::Point3 *point, sheep::Vector3 *geometric_normal) const
virtual bool Intersect (const Context &context, const Ray &ray, Hit *hit=0) const
virtual void ComputeIrradiance (const Context &context, const Scene *scene, const sheep::Point3 &point, const sheep::Vector3 &geometric_normal, const sheep::Vector3 &shading_normal, const ISurfaceSampler::SampleVector &input, IrradianceSampleVector *output) const

Private Attributes

sheep::Point3 m_center
 Center of the object, expressed in world space.

sheep::Vector3 m_ex
sheep::Vector3 m_ey
sheep::Vector3 m_ez
 Basis vectors, expressed in world space.

sheep::AABB3 m_aabb
 Bounding box of the object, expressed in world space.

sheep::BS m_bs
 Bounding sphere of the sphere, expressed in world space.


Constructor & Destructor Documentation

Sphere::Sphere const sheep::Matrix4 m,
const ISurfaceShader surface_shader,
IntersectionMask  intersection_mask = INTERSECT_ALL_RAYS
 

m is the object space to world space transformation matrix.

Definition at line 44 of file sphere.cpp.

References sheep::BS::ComputeSquareRadius(), sheep::AABB3::Extend(), sheep::BS::Include(), m_bs, toxic::OBJECT_AABB_EXTENSION(), sheep::AABB3::Transform(), and toxic::Basis::TransformToWorld().


Member Function Documentation

void Sphere::ComputeIrradiance const Context context,
const Scene scene,
const sheep::Point3 point,
const sheep::Vector3 geometric_normal,
const sheep::Vector3 shading_normal,
const ISurfaceSampler::SampleVector input,
IrradianceSampleVector output
const [virtual]
 

Computes irradiance due to this light source. The point and the surface normal are both expressed in world space.

Todo:
Optimize (inline and simplify expressions).

Flip the normal? Call Hit::ExtractIntersection()?

Not sure which normal to use.

Reimplemented from toxic::IAreaLight.

Definition at line 155 of file sphere.cpp.

References toxic::ISurfaceShader::GetEDF(), toxic::IEDF::GetEmittedRadiance(), toxic::ISurfaceShader::GetRadiantExitance(), toxic::IObject::GetSurfaceShader(), Intersect(), sheep::Vector3::IsUnitLength(), toxic::Hit::m_abscissa, m_bs, sheep::BS::m_center, toxic::Hit::m_geometric_normal, toxic::Hit::m_object, sheep::BS::m_radius2, toxic::Statistics::m_shadow_rays, toxic::Context::m_statistics, sheep::PI, toxic::ISurfaceSampler::SampleVector, toxic::SphericalCoordsToVector(), sheep::Vector3::SquareNorm(), toxic::Scene::Trace(), toxic::Basis::TransformNormalToWorld(), and toxic::SurfaceBasis::TransformToWorld().

Real Sphere::ComputeSurfaceArea  )  const [virtual]
 

Computes the surface area of this object.

Todo:
Implement. Ellipsoid Surface Area: http://documents.wolfram.com/v4/MainBook/G.1.7.html Source Code: http://www.tcs.auckland.ac.nz/dgt/Source_Code.php?id=2

Implements toxic::IBoundedObject.

Definition at line 71 of file sphere.cpp.

References sheep::Vector3::Norm(), and sheep::PI.

void Sphere::EvaluateSurface const sheep::Point2 input,
sheep::Point3 point,
sheep::Vector3 geometric_normal
const [virtual]
 

Given a point in the unit square (the set of points in [0..1]^2), this method computes the corresponding surface point and normal (both are expressed in world space).

Implements toxic::IBoundedObject.

Definition at line 84 of file sphere.cpp.

References sheep::Vector3::m_x, sheep::Point2::m_x, sheep::Vector3::m_y, sheep::Point2::m_y, sheep::Vector3::m_z, toxic::Basis::TransformNormalToWorld(), and UniformSphereSampling().

const sheep::AABB3 & Sphere::GetAABB  )  const [inline, virtual]
 

Returns the Axis Aligned Bounding Box of this object. The AABB is expressed in world space.

Implements toxic::IBoundedObject.

Definition at line 125 of file sphere.h.

bool Sphere::Intersect const Context context,
const Ray ray,
Hit hit = 0
const [virtual]
 

This method returns true if the ray intersect the object, or false otherwise. If 'hit' is not null, intersection data are reported through the 'hit' parameter (only if an intersection has been found; if no intersection has been found, the 'hit' parameter is left unchanged). The ray is expressed in world space.

Todo:
Not sure: should t in r.GetPointAt(t) be in object space or in world space?
Parameters:
ray  'ray' is expressed in world space.

Implements toxic::IObject.

Definition at line 102 of file sphere.cpp.

References toxic::Ray::GetPointAt(), toxic::Ray::GetType(), toxic::Hit::m_abscissa, toxic::Ray::m_direction, toxic::Hit::m_geometric_normal, toxic::Statistics::m_intersections_found, toxic::Hit::m_object, toxic::Ray::m_origin, toxic::Hit::m_shading_normal, toxic::Context::m_statistics, toxic::Statistics::m_tested_intersections, sheep::Vector3::SquareNorm(), and toxic::Basis::TransformToLocal().

Referenced by ComputeIrradiance().


Member Data Documentation

sheep::AABB3 toxic::Sphere::m_aabb [private]
 

Bounding box of the object, expressed in world space.

Definition at line 98 of file sphere.h.

sheep::BS toxic::Sphere::m_bs [private]
 

Bounding sphere of the sphere, expressed in world space.

Definition at line 99 of file sphere.h.

Referenced by ComputeIrradiance(), and Sphere().

sheep::Point3 toxic::Sphere::m_center [private]
 

Center of the object, expressed in world space.

Definition at line 96 of file sphere.h.

sheep::Vector3 toxic::Sphere::m_ex [private]
 

Definition at line 97 of file sphere.h.

sheep::Vector3 toxic::Sphere::m_ey [private]
 

Definition at line 97 of file sphere.h.

sheep::Vector3 toxic::Sphere::m_ez [private]
 

Basis vectors, expressed in world space.

Definition at line 97 of file sphere.h.


The documentation for this class was generated from the following files:
Generated on Tue May 11 01:31:58 2004 for toxic by doxygen 1.3.6