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

Parallelogram Class Reference

A Parellelogram primitive. More...

#include <surfaces/Parallelogram.h>

Inheritance diagram for Parallelogram:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Parallelogram (const Vector3 &_base, const Vector3 &_u, const Vector3 &_v, SurfaceShader *_sshader)
 Parallelogram (const Vector3 &_base, const Vector3 &_u, const Vector3 &_v, SurfaceShader *_sshader, LightShader *_ls)
 Parallelogram (const Vector3 &_base, const Vector3 &_u, const Vector3 &_v, const Vector2 &_uv0, const Vector2 &_uv1, const Vector2 &_uv2, SurfaceShader *_sshader)
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

Public Attributes

ONB uvw
 ONB of the parallelogram.
Vector3 unorm
 normalized u offset
Vector3 vnorm
 normalized v offset
double inverse_area
 1/area for pdf calculations
SurfaceShadersshader
LightShaderls
One vertex and offsets to neighbors.

Vector3 base
Vector3 u
Vector3 v
Texture coordinates.

Vector2 uv0
Vector2 uv1
Vector2 uv2

Detailed Description

A Parellelogram primitive.


Member Function Documentation

bool Parallelogram::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 Parallelogram::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 Parallelogram::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 Parallelogram::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 Parallelogram::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 Parallelogram::randomDirection const HitRecord rec,
Context context,
Vector3 w_in,
double &  pdf
const [virtual]
 

Randomly sample the solid angle subtended by the surface from rec.p.

Parameters:
[in] rec The record of the point being shaded.
[in] context Contains seeds for sampling.
[out] w_in The generated sample direction.
[out] pdf The pdf of the sampled direction.
Returns:
Returns true if a direction was generated.

Reimplemented from Surface.

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

We assume that a point is chosen at random on the parallelogram, so the pdf with area measure is 1/A. For a given point on the parallelogram with area dA we know $(1/A) dA = q(\omega_{in})d\Omega$ . We also know that $d\Omega = dA cosine / dist^2$ , so $(1/A) = q(\omega_{in}) cosine / dist^2$ so $q(\omega_{in}) = dist^2 / (A cosine)$ .

Reimplemented from Surface.


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