toxi.geom
Class SphereIntersectorReflector

java.lang.Object
  extended by toxi.geom.SphereIntersectorReflector
All Implemented Interfaces:
Intersector, Reflector

public class SphereIntersectorReflector
extends java.lang.Object
implements Intersector, Reflector


Constructor Summary
SphereIntersectorReflector(Sphere s)
           
SphereIntersectorReflector(Vec3D o, float r)
           
 
Method Summary
 Vec3D getIntersectionDir(boolean normalized)
           
 float getIntersectionDistance()
           
 Vec3D getIntersectionPoint()
           
 Vec3D getNormalAtIntersection()
           
 Vec3D getReflectedRayPointAtDistance(float dist)
          Returns the point on the reflected ray at given distance from the intersection point
 float getReflectionAngle()
           
 float intersectRayDistance(Ray3D ray)
          Calculates the distance of the vector to the given sphere in the specified direction.
 boolean intersectsRay(Ray3D ray)
          Check if entity intersects with the given ray
 Ray3D reflectRay(Ray3D ray)
          Reflects given ray on the entity's surface
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SphereIntersectorReflector

public SphereIntersectorReflector(Sphere s)

SphereIntersectorReflector

public SphereIntersectorReflector(Vec3D o,
                                  float r)
Method Detail

getIntersectionDir

public Vec3D getIntersectionDir(boolean normalized)
Specified by:
getIntersectionDir in interface Intersector
Parameters:
normalized - true, if a normalized version should be returned
Returns:
direction vector from ray origin to intersection point

getIntersectionDistance

public float getIntersectionDistance()
Specified by:
getIntersectionDistance in interface Intersector
Returns:
distance from ray origin to intersection point

getIntersectionPoint

public Vec3D getIntersectionPoint()
Specified by:
getIntersectionPoint in interface Intersector
Returns:
point of intersection on the entity surface

getNormalAtIntersection

public Vec3D getNormalAtIntersection()
Specified by:
getNormalAtIntersection in interface Intersector
Returns:
entity's surface normal vector at intersection point

getReflectedRayPointAtDistance

public Vec3D getReflectedRayPointAtDistance(float dist)
Description copied from interface: Reflector
Returns the point on the reflected ray at given distance from the intersection point

Specified by:
getReflectedRayPointAtDistance in interface Reflector
Parameters:
dist - distance from isect position
Returns:
point on reflected ray

getReflectionAngle

public float getReflectionAngle()
Specified by:
getReflectionAngle in interface Reflector
Returns:
angle between incident ray and surface normal

intersectRayDistance

public float intersectRayDistance(Ray3D ray)
Calculates the distance of the vector to the given sphere in the specified direction. A sphere is defined by a 3D point and a radius. Normalized directional vectors expected.

Parameters:
ray - intersection ray
Returns:
distance to sphere in world units, -1 if no intersection.

intersectsRay

public boolean intersectsRay(Ray3D ray)
Description copied from interface: Intersector
Check if entity intersects with the given ray

Specified by:
intersectsRay in interface Intersector
Parameters:
ray - ray to check
Returns:
true, if ray hits the entity

reflectRay

public Ray3D reflectRay(Ray3D ray)
Description copied from interface: Reflector
Reflects given ray on the entity's surface

Specified by:
reflectRay in interface Reflector
Parameters:
ray - incident ray
Returns:
reflected ray starting from intersection point