|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.sunflow.core.Ray
public final class Ray
This class represents a ray as a oriented half line segment. The ray direction is always normalized. The valid region is delimted by two distances along the ray, tMin and tMax.
Field Summary | |
---|---|
float |
dx
|
float |
dy
|
float |
dz
|
float |
ox
|
float |
oy
|
float |
oz
|
Constructor Summary | |
---|---|
Ray(float ox,
float oy,
float oz,
float dx,
float dy,
float dz)
Creates a new ray that points from the given origin to the given direction. |
|
Ray(Point3 a,
Point3 b)
Creates a new ray that points from point a to point b. |
|
Ray(Point3 o,
Vector3 d)
Creates a new ray that points from the given origin to the given direction. |
Method Summary | |
---|---|
float |
dot(float vx,
float vy,
float vz)
Computes the dot product of an arbitrary vector with the direction of the ray. |
float |
dot(Vector3 v)
Computes the dot product of an arbitrary vector with the direction of the ray. |
Vector3 |
getDirection()
Creates a vector to represent the direction of the ray. |
float |
getMax()
Gets the maximum distance along the ray. |
float |
getMin()
Gets the minimum distance along the ray - usually 0. |
Point3 |
getPoint(Point3 dest)
Gets the end point of the ray. |
boolean |
isInside(float t)
Checks to see if the specified distance falls within the valid range on this ray. |
void |
normalize()
Normalize the direction component of the ray. |
void |
setMax(float t)
Updates the maximum to the specified distance if and only if the new distance is smaller than the current one. |
void |
setMinMax(float min,
float max)
|
Ray |
transform(Matrix4 m)
Create a new ray by transforming the supplied one by the given matrix. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public float ox
public float oy
public float oz
public float dx
public float dy
public float dz
Constructor Detail |
---|
public Ray(float ox, float oy, float oz, float dx, float dy, float dz)
ox
- ray origin xoy
- ray origin yoz
- ray origin zdx
- ray direction xdy
- ray direction ydz
- ray direction zpublic Ray(Point3 o, Vector3 d)
o
- ray origind
- ray direction (need not be normalized)public Ray(Point3 a, Point3 b)
a
- start pointb
- end pointMethod Detail |
---|
public Ray transform(Matrix4 m)
null
, the original ray is returned.
m
- matrix to transform the ray bypublic void normalize()
public final float getMin()
public final float getMax()
public final Vector3 getDirection()
public final boolean isInside(float t)
t
- distance to be tested
true
if t falls between the minimum and maximum
distance of this ray, false
otherwisepublic final Point3 getPoint(Point3 dest)
dest
is
returned to support chaining.
dest
- reference to the point to store
dest
public final float dot(Vector3 v)
v
- vector
public final float dot(float vx, float vy, float vz)
vx
- vector x coordinatevy
- vector y coordinatevz
- vector z coordinate
public final void setMax(float t)
t
- new maximum distancepublic void setMinMax(float min, float max)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |