com.jme3.math
クラス Ray

java.lang.Object
  上位を拡張 com.jme3.math.Ray
すべての実装されたインタフェース:
Collidable, Savable, java.io.Serializable, java.lang.Cloneable

public final class Ray
extends java.lang.Object
implements Savable, java.lang.Cloneable, Collidable, java.io.Serializable

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.

関連項目:
直列化された形式

フィールドの概要
 Vector3f direction
          The direction of the ray.
 float limit
           
 Vector3f origin
          The ray's begining point.
 
コンストラクタの概要
Ray()
          Constructor instantiates a new Ray object.
Ray(Vector3f origin, Vector3f direction)
          Constructor instantiates a new Ray object.
 
メソッドの概要
 Ray clone()
           
 int collideWith(Collidable other, CollisionResults results)
          Check collision with another Collidable.
 float distanceSquared(Vector3f point)
           
 Vector3f getDirection()
          getDirection retrieves the direction vector of the ray.
 float getLimit()
          getLimit returns the limit or the ray, aka the length.
 Vector3f getOrigin()
          getOrigin retrieves the origin point of the ray.
 float intersects(Vector3f v0, Vector3f v1, Vector3f v2)
           
 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 setLimit(float limit)
          setLimit sets the limit of the ray.
 void setOrigin(Vector3f origin)
          setOrigin sets the origin of the ray.
 java.lang.String toString()
           
 void write(JmeExporter e)
           
 
クラス java.lang.Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

フィールドの詳細

origin

public Vector3f origin
The ray's begining point.


direction

public Vector3f direction
The direction of the ray.


limit

public float limit
コンストラクタの詳細

Ray

public Ray()
Constructor instantiates a new Ray object. As default, the origin is (0,0,0) and the direction is (0,0,0).


Ray

public Ray(Vector3f origin,
           Vector3f direction)
Constructor instantiates a new Ray object. The origin and direction are given.

パラメータ:
origin - the origin of the ray.
direction - the direction the ray travels in.
メソッドの詳細

intersectWhere

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)
戻り値:
true if the ray collides.

intersectWhere

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.
戻り値:
true if the ray collides.

intersectWherePlanar

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
戻り値:
true if the ray collides.

intersectWherePlanar

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
戻り値:
true if the ray collides.

intersects

public float intersects(Vector3f v0,
                        Vector3f v1,
                        Vector3f v2)

intersectWherePlanarQuad

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
戻り値:
true if the ray collides with the quad.

intersectsWherePlane

public boolean intersectsWherePlane(Plane p,
                                    Vector3f loc)
パラメータ:
p -
loc -
戻り値:
true if the ray collides with the given Plane

collideWith

public int collideWith(Collidable other,
                       CollisionResults results)
インタフェース Collidable の記述:
Check collision with another Collidable.

定義:
インタフェース Collidable 内の collideWith
パラメータ:
other - The object to check collision against
results - Will contain the list of CollisionResults.
戻り値:
how many collisions were found between this and other

distanceSquared

public float distanceSquared(Vector3f point)

getOrigin

public Vector3f getOrigin()
getOrigin retrieves the origin point of the ray.

戻り値:
the origin of the ray.

setOrigin

public void setOrigin(Vector3f origin)
setOrigin sets the origin of the ray.

パラメータ:
origin - the origin of the ray.

getLimit

public float getLimit()
getLimit returns the limit or the ray, aka the length. If the limit is not infinity, then this ray is a line with length limit.

戻り値:
the limit or the ray, aka the length.

setLimit

public void setLimit(float limit)
setLimit sets the limit of the ray.

パラメータ:
limit - the limit of the ray.
関連項目:
getLimit()

getDirection

public Vector3f getDirection()
getDirection retrieves the direction vector of the ray.

戻り値:
the direction of the ray.

setDirection

public void setDirection(Vector3f direction)
setDirection sets the direction vector of the ray.

パラメータ:
direction - the direction of the ray.

set

public void set(Ray source)
Copies information from a source ray into this ray.

パラメータ:
source - the ray to copy information from

toString

public java.lang.String toString()
オーバーライド:
クラス java.lang.Object 内の toString

write

public void write(JmeExporter e)
           throws java.io.IOException
定義:
インタフェース Savable 内の write
例外:
java.io.IOException

read

public void read(JmeImporter e)
          throws java.io.IOException
定義:
インタフェース Savable 内の read
例外:
java.io.IOException

clone

public Ray clone()
オーバーライド:
クラス java.lang.Object 内の clone