Contents User Forum Source Index APIs by Task APIs by Level Data


G3D::Ray Class Reference

A 3D Ray. More...

#include <Ray.h>

List of all members.

Public Member Functions

Vector3 closestPoint (const Vector3 &point) const
void deserialize (class BinaryInput &b)
float distance (const Vector3 &point) const
Vector3 intersection (const class Plane &plane) const
float intersectionTime (const Triangle &triangle, double &w0, double &w1, double &w2) const
float intersectionTime (const Triangle &triangle) const
float intersectionTime (const Vector3 &vert0, const Vector3 &vert1, const Vector3 &vert2, double &w0, double &w1, double &w2) const
float intersectionTime (const Vector3 &vert0, const Vector3 &vert1, const Vector3 &vert2) const
float intersectionTime (const Vector3 &vert0, const Vector3 &vert1, const Vector3 &vert2, const Vector3 &edge01, const Vector3 &edge02) const
float intersectionTime (const Vector3 &v0, const Vector3 &v1, const Vector3 &v2, const Vector3 &edge01, const Vector3 &edge02, double &w0, double &w1, double &w2) const
float intersectionTime (const class AABox &box) const
float intersectionTime (const class Box &box) const
float intersectionTime (const class Plane &plane) const
float intersectionTime (const class Sphere &sphere) const
 Ray (class BinaryInput &b)
 Ray ()
Ray reflect (const Vector3 &newOrigin, const Vector3 &normal) const
Ray refract (const Vector3 &newOrigin, const Vector3 &normal, float iInside, float iOutside) const
void serialize (class BinaryOutput &b) const
Ray unit () const

Static Public Member Functions

static Ray fromOriginAndDirection (const Vector3 &point, const Vector3 &direction)

Public Attributes

Vector3 direction
Vector3 origin


Detailed Description

A 3D Ray.


Constructor & Destructor Documentation

G3D::Ray::Ray (  )  [inline]

G3D::Ray::Ray ( class BinaryInput b  ) 


Member Function Documentation

Vector3 G3D::Ray::closestPoint ( const Vector3 point  )  const [inline]

Returns the closest point on the Ray to point.

void G3D::Ray::deserialize ( class BinaryInput b  ) 

float G3D::Ray::distance ( const Vector3 point  )  const [inline]

Returns the closest distance between point and the Ray.

static Ray G3D::Ray::fromOriginAndDirection ( const Vector3 point,
const Vector3 direction 
) [inline, static]

Creates a Ray from a origin and a (nonzero) direction.

Vector3 G3D::Ray::intersection ( const class Plane plane  )  const

Returns the point where the Ray and plane intersect.

If there is no intersection, returns a point at infinity.

Planes are considered one-sided, so the ray will not intersect a plane where the normal faces in the traveling direction.

float G3D::Ray::intersectionTime ( const Triangle triangle,
double &  w0,
double &  w1,
double &  w2 
) const [inline]

float G3D::Ray::intersectionTime ( const Triangle triangle  )  const [inline]

float G3D::Ray::intersectionTime ( const Vector3 vert0,
const Vector3 vert1,
const Vector3 vert2,
double &  w0,
double &  w1,
double &  w2 
) const [inline]

float G3D::Ray::intersectionTime ( const Vector3 vert0,
const Vector3 vert1,
const Vector3 vert2 
) const [inline]

float G3D::Ray::intersectionTime ( const Vector3 vert0,
const Vector3 vert1,
const Vector3 vert2,
const Vector3 edge01,
const Vector3 edge02 
) const [inline]

Ray-triangle intersection for a 1-sided triangle.

Fastest version.

Referenced Code:
http://www.acm.org/jgt/papers/MollerTrumbore97/ http://www.graphics.cornell.edu/pubs/1997/MT97.html

float G3D::Ray::intersectionTime ( const Vector3 v0,
const Vector3 v1,
const Vector3 v2,
const Vector3 edge01,
const Vector3 edge02,
double &  w0,
double &  w1,
double &  w2 
) const [inline]

The three extra arguments are the weights of vertices 0, 1, and 2 at the intersection point; they are useful for texture mapping and interpolated normals.

float G3D::Ray::intersectionTime ( const class AABox box  )  const

float G3D::Ray::intersectionTime ( const class Box box  )  const

float G3D::Ray::intersectionTime ( const class Plane plane  )  const

float G3D::Ray::intersectionTime ( const class Sphere sphere  )  const

Returns the distance until intersection with the (solid) sphere.

Will be 0 if inside the sphere, inf if there is no intersection.

The ray direction is not normalized. If the ray direction has unit length, the distance from the origin to intersection is equal to the time. If the direction does not have unit length, the distance = time * direction.length().

See also the G3D::CollisionDetection "movingPoint" methods, which give more information about the intersection.

Ray G3D::Ray::reflect ( const Vector3 newOrigin,
const Vector3 normal 
) const

Reflects about the normal using G3D::Vector3::reflectionDirection and bumps the ray slightly from the newOrigin.

Ray G3D::Ray::refract ( const Vector3 newOrigin,
const Vector3 normal,
float  iInside,
float  iOutside 
) const

Refracts about the normal using G3D::Vector3::refractionDirection and bumps the ray slightly from the newOrigin.

void G3D::Ray::serialize ( class BinaryOutput b  )  const

Ray G3D::Ray::unit (  )  const [inline]


Member Data Documentation

Not unit length.


The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:47 2007 for G3D by doxygen 1.5.2
Hosted by SourceForge.net Logo