toxi.geom
Class Ray3D

java.lang.Object
  extended by toxi.geom.Vec3D
      extended by toxi.geom.Ray3D
All Implemented Interfaces:
java.lang.Comparable<ReadonlyVec3D>, ReadonlyVec3D

public class Ray3D
extends Vec3D

A simple 3D ray datatype


Nested Class Summary
 
Nested classes/interfaces inherited from class toxi.geom.Vec3D
Vec3D.Axis
 
Field Summary
 
Fields inherited from class toxi.geom.Vec3D
MAX_VALUE, MIN_VALUE, x, X_AXIS, y, Y_AXIS, z, Z_AXIS, ZERO
 
Constructor Summary
Ray3D()
           
Ray3D(float x, float y, float z, ReadonlyVec3D d)
           
Ray3D(ReadonlyVec3D o, ReadonlyVec3D d)
           
 
Method Summary
 Vec3D getDirection()
          Returns a copy of the ray's direction vector.
 float getDistanceToPoint(Vec3D p)
          Calculates the distance between the given point and the infinite line coinciding with this ray.
 Vec3D getPointAtDistance(float dist)
          Returns the point at the given distance on the ray.
 Ray3D setDirection(ReadonlyVec3D d)
          Uses a normalized copy of the given vector as the ray direction.
 Line3D toLine3DWithPointAtDistance(float dist)
          Converts the ray into a 3D Line segment with its start point coinciding with the ray origin and its other end point at the given distance along the ray.
 java.lang.String toString()
           
 
Methods inherited from class toxi.geom.Vec3D
abs, add, add, add, addSelf, addSelf, angleBetween, angleBetween, clear, compareTo, constrain, constrain, copy, cross, cross, crossInto, crossSelf, distanceTo, distanceToSquared, dot, dot, equals, equalsWithTolerance, floor, frac, fromXYTheta, fromXZTheta, fromYZTheta, getAbs, getComponent, getComponent, getConstrained, getFloored, getFrac, getInverted, getLimited, getNormalized, getNormalizedTo, getReciprocal, getReflected, getRotatedAroundAxis, getRotatedX, getRotatedY, getRotatedZ, getSignum, hashCode, headingXY, headingXZ, headingYZ, immutable, interpolateTo, interpolateTo, interpolateTo, interpolateTo, interpolateToSelf, interpolateToSelf, invert, isInAABB, isInAABB, isMajorAxis, isZeroVector, jitter, jitter, jitter, jitter, jitter, jitter, limit, magnitude, magSquared, max, maxSelf, min, minSelf, modSelf, modSelf, normalize, normalizeTo, randomVector, randomVector, reciprocal, reflect, rotateAroundAxis, rotateX, rotateY, rotateZ, roundToAxis, scale, scale, scale, scale, scaleSelf, scaleSelf, scaleSelf, set, set, set, setComponent, setComponent, setXY, shuffle, signum, sub, sub, sub, subSelf, subSelf, to2DXY, to2DXZ, to2DYZ, toArray, toArray4, toCartesian, toSpherical, x, y, z
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Ray3D

public Ray3D()

Ray3D

public Ray3D(float x,
             float y,
             float z,
             ReadonlyVec3D d)

Ray3D

public Ray3D(ReadonlyVec3D o,
             ReadonlyVec3D d)
Method Detail

getDirection

public Vec3D getDirection()
Returns a copy of the ray's direction vector.

Returns:
vector

getDistanceToPoint

public float getDistanceToPoint(Vec3D p)
Calculates the distance between the given point and the infinite line coinciding with this ray.

Parameters:
p -
Returns:
distance

getPointAtDistance

public Vec3D getPointAtDistance(float dist)
Returns the point at the given distance on the ray. The distance can be any real number.

Parameters:
dist -
Returns:
vector

setDirection

public Ray3D setDirection(ReadonlyVec3D d)
Uses a normalized copy of the given vector as the ray direction.

Parameters:
d - new direction
Returns:
itself

toLine3DWithPointAtDistance

public Line3D toLine3DWithPointAtDistance(float dist)
Converts the ray into a 3D Line segment with its start point coinciding with the ray origin and its other end point at the given distance along the ray.

Parameters:
dist - end point distance
Returns:
line segment

toString

public java.lang.String toString()
Overrides:
toString in class Vec3D