|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.math.Ray
public class Ray
Ray
defines a line segment which has an origin and a direction.
That is, a point and an infinite ray is cast from this point. The ray is
defined by the following equation: R(t) = origin + t*direction for t >= 0.
Field Summary | |
---|---|
Vector3f |
direction
The direction of the ray. |
Vector3f |
origin
The ray's begining point. |
protected static Vector3f |
tempVa
|
protected static Vector3f |
tempVb
|
protected static Vector3f |
tempVc
|
protected static Vector3f |
tempVd
|
Constructor Summary | |
---|---|
Ray()
Constructor instantiates a new Ray object. |
|
Ray(Vector3f origin,
Vector3f direction)
Constructor instantiates a new Ray object. |
Method Summary | |
---|---|
Ray |
clone()
|
float |
distanceSquared(Vector3f point)
|
java.lang.Class<? extends Ray> |
getClassTag()
|
Vector3f |
getDirection()
getDirection retrieves the direction vector of the ray. |
Vector3f |
getOrigin()
getOrigin retrieves the origin point of the ray. |
boolean |
intersect(Triangle t)
intersect determines if the Ray intersects a triangle. |
boolean |
intersect(Vector3f v0,
Vector3f v1,
Vector3f v2)
intersect determines if the Ray intersects a triangle
defined by the specified points. |
boolean |
intersectsWherePlane(Plane p,
Vector3f loc)
|
boolean |
intersectWhere(Triangle t,
Vector3f loc)
intersectWhere determines if the Ray intersects a triangle. |
boolean |
intersectWhere(Vector3f v0,
Vector3f v1,
Vector3f v2,
Vector3f loc)
intersectWhere determines if the Ray intersects a triangle
defined by the specified points and if so it stores the point of
intersection in the given loc vector. |
boolean |
intersectWherePlanar(Triangle t,
Vector3f loc)
intersectWherePlanar determines if the Ray intersects a
triangle and if so it stores the point of
intersection in the given loc vector as t, u, v where t is the distance
from the origin to the point of intersection and u,v is the intersection
point in terms of the triangle plane. |
boolean |
intersectWherePlanar(Vector3f v0,
Vector3f v1,
Vector3f v2,
Vector3f loc)
intersectWherePlanar determines if the Ray intersects a
triangle defined by the specified points and if so it stores the point of
intersection in the given loc vector as t, u, v where t is the distance
from the origin to the point of intersection and u,v is the intersection
point in terms of the triangle plane. |
boolean |
intersectWherePlanarQuad(Vector3f v0,
Vector3f v1,
Vector3f v2,
Vector3f loc)
intersectWherePlanar determines if the Ray intersects a
quad defined by the specified points and if so it stores the point of
intersection in the given loc vector as t, u, v where t is the distance
from the origin to the point of intersection and u,v is the intersection
point in terms of the quad plane. |
void |
read(JMEImporter e)
|
void |
set(Ray source)
Copies information from a source ray into this ray. |
void |
setDirection(Vector3f direction)
setDirection sets the direction vector of the ray. |
void |
setOrigin(Vector3f origin)
setOrigin sets the origin of the ray. |
void |
write(JMEExporter e)
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public Vector3f origin
public Vector3f direction
protected static final Vector3f tempVa
protected static final Vector3f tempVb
protected static final Vector3f tempVc
protected static final Vector3f tempVd
Constructor Detail |
---|
public Ray()
Ray
object. As default, the
origin is (0,0,0) and the direction is (0,0,0).
public Ray(Vector3f origin, Vector3f direction)
Ray
object. The origin and
direction are given.
origin
- the origin of the ray.direction
- the direction the ray travels in.Method Detail |
---|
public boolean intersect(Triangle t)
intersect
determines if the Ray intersects a triangle.
t
- the Triangle to test against.
public boolean intersect(Vector3f v0, Vector3f v1, Vector3f v2)
intersect
determines if the Ray intersects a triangle
defined by the specified points.
v0
- first point of the triangle.v1
- second point of the triangle.v2
- third point of the triangle.
public boolean intersectWhere(Triangle t, Vector3f loc)
intersectWhere
determines if the Ray intersects a triangle. It then
stores the point of intersection in the given loc vector
t
- the Triangle to test against.loc
- storage vector to save the collision point in (if the ray
collides)
public boolean intersectWhere(Vector3f v0, Vector3f v1, Vector3f v2, Vector3f loc)
intersectWhere
determines if the Ray intersects a triangle
defined by the specified points and if so it stores the point of
intersection in the given loc vector.
v0
- first point of the triangle.v1
- second point of the triangle.v2
- third point of the triangle.loc
- storage vector to save the collision point in (if the ray
collides) if null, only boolean is calculated.
public boolean intersectWherePlanar(Triangle t, Vector3f loc)
intersectWherePlanar
determines if the Ray intersects a
triangle and if so it stores the point of
intersection in the given loc vector as t, u, v where t is the distance
from the origin to the point of intersection and u,v is the intersection
point in terms of the triangle plane.
t
- the Triangle to test against.loc
- storage vector to save the collision point in (if the ray
collides) as t, u, v
public boolean intersectWherePlanar(Vector3f v0, Vector3f v1, Vector3f v2, Vector3f loc)
intersectWherePlanar
determines if the Ray intersects a
triangle defined by the specified points and if so it stores the point of
intersection in the given loc vector as t, u, v where t is the distance
from the origin to the point of intersection and u,v is the intersection
point in terms of the triangle plane.
v0
- first point of the triangle.v1
- second point of the triangle.v2
- third point of the triangle.loc
- storage vector to save the collision point in (if the ray
collides) as t, u, v
public boolean intersectWherePlanarQuad(Vector3f v0, Vector3f v1, Vector3f v2, Vector3f loc)
intersectWherePlanar
determines if the Ray intersects a
quad defined by the specified points and if so it stores the point of
intersection in the given loc vector as t, u, v where t is the distance
from the origin to the point of intersection and u,v is the intersection
point in terms of the quad plane.
One edge of the quad is [v0,v1], another one [v0,v2]. The behaviour thus is like
intersectWherePlanar(Vector3f, Vector3f, Vector3f, Vector3f)
except for
the extended area, which is equivalent to the union of the triangles [v0,v1,v2]
and [-v0+v1+v2,v1,v2].
v0
- top left point of the quad.v1
- top right point of the quad.v2
- bottom left point of the quad.loc
- storage vector to save the collision point in (if the ray
collides) as t, u, v
public boolean intersectsWherePlane(Plane p, Vector3f loc)
p
- loc
-
public float distanceSquared(Vector3f point)
public Vector3f getOrigin()
getOrigin
retrieves the origin point of the ray.
public void setOrigin(Vector3f origin)
setOrigin
sets the origin of the ray.
origin
- the origin of the ray.public Vector3f getDirection()
getDirection
retrieves the direction vector of the ray.
public void setDirection(Vector3f direction)
setDirection
sets the direction vector of the ray.
direction
- the direction of the ray.public void set(Ray source)
source
- the ray to copy information frompublic void write(JMEExporter e) throws java.io.IOException
write
in interface Savable
java.io.IOException
public void read(JMEImporter e) throws java.io.IOException
read
in interface Savable
java.io.IOException
public java.lang.Class<? extends Ray> getClassTag()
getClassTag
in interface Savable
public Ray clone()
clone
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |