mathematik
Class Intersection

java.lang.Object
  extended by mathematik.Intersection
All Implemented Interfaces:
java.io.Serializable, Mathematik

public final class Intersection
extends java.lang.Object
implements java.io.Serializable, Mathematik

beware this is not really in good shape. i ll read my linear algebra book and fix this class. someday. hopefully.

See Also:
Serialized Form

Nested Class Summary
static class Intersection.Result
           
 
Field Summary
static int COINCIDENT
          from paul bourke ( http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ )
static int INTERESECTING
           
static int NOT_INTERESECTING
           
static int PARALLEL
           
 
Fields inherited from interface mathematik.Mathematik
EPSILON
 
Constructor Summary
Intersection()
           
 
Method Summary
static float intersectLinePlane(Ray3f theRay, Plane3f thePlane, Vector3f theIntersectionPoint)
          grabbed from Xith
static float intersectRayPlane(Ray3f theRay, Plane3f thePlane)
          Deprecated. this method might contain errors.
static boolean intersectRayPlane(Ray3f theRay, Plane3f thePlane, Vector3f theResult)
          Deprecated. this method might contain errors.
static boolean intersectRayPlane(Ray3f theRay, Plane3f thePlane, Vector3f store, boolean doPlanar, boolean quad)
           
static boolean intersectRayPlane(Vector3f theRayOrigin, Vector3f theRayDirection, Vector3f thePlanePointA, Vector3f thePlanePointB, Vector3f thePlanePointC, Vector3f theResult)
          Deprecated. this method might contain errors.
static boolean intersectRayTriangle(Vector3f orig, Vector3f dir, Vector3f vert0, Vector3f vert1, Vector3f vert2, float[] result)
           
static boolean intersectRayTriangle(Vector3f theRayOrigin, Vector3f theRayDirection, Vector3f theVertex0, Vector3f theVertex1, Vector3f theVertex2, Intersection.Result theResult, boolean theCullingFlag)
          Fast, Minimum Storage Ray-Triangle Intersection by Tomas Moeller & Ben Trumbore http://jgt.akpeters.com/papers/MollerTrumbore97/code.html
static float intersectRayTriangle(Vector3f theRayOrigin, Vector3f theRayDirection, Vector3f thePlanePointA, Vector3f thePlanePointB, Vector3f thePlanePointC, Vector3f theResult, boolean theCullingFlag)
           
static int lineLineIntersect(Vector2f aBegin, Vector2f aEnd, Vector2f bBegin, Vector2f bEnd, Vector2f theIntersection)
           
static boolean lineLineIntersect(Vector3f p1, Vector3f p2, Vector3f p3, Vector3f p4, Vector3f pa, Vector3f pb, float[] theResult)
          from paul bourke ( http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline3d/ ) Calculate the line segment PaPb that is the shortest route between two lines P1P2 and P3P4.
static void main(java.lang.String[] args)
           
static boolean RaySphere(Vector3f p1, Vector3f p2, Vector3f sc, float r)
          http://local.wasp.uwa.edu.au/~pbourke/geometry/sphereline/raysphere.c Calculate the intersection of a ray and a sphere The line segment is defined from p1 to p2 The sphere is of radius r and centered at sc There are potentially two points of intersection given by p = p1 + mu1 (p2 - p1) p = p1 + mu2 (p2 - p1) Return FALSE if the ray doesn't intersect the sphere.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COINCIDENT

public static final int COINCIDENT
from paul bourke ( http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ )

See Also:
Constant Field Values

PARALLEL

public static final int PARALLEL
See Also:
Constant Field Values

INTERESECTING

public static final int INTERESECTING
See Also:
Constant Field Values

NOT_INTERESECTING

public static final int NOT_INTERESECTING
See Also:
Constant Field Values
Constructor Detail

Intersection

public Intersection()
Method Detail

intersectRayPlane

public static boolean intersectRayPlane(Ray3f theRay,
                                        Plane3f thePlane,
                                        Vector3f store,
                                        boolean doPlanar,
                                        boolean quad)

intersectRayTriangle

public static boolean intersectRayTriangle(Vector3f orig,
                                           Vector3f dir,
                                           Vector3f vert0,
                                           Vector3f vert1,
                                           Vector3f vert2,
                                           float[] result)

intersectLinePlane

public static float intersectLinePlane(Ray3f theRay,
                                       Plane3f thePlane,
                                       Vector3f theIntersectionPoint)
grabbed from Xith

Parameters:
thePlane - Plane3f
theRay - Ray3f
theIntersectionPoint - Vector3f
Returns:
float
To do:
not sure whether this is for ray-plane or line-plane intersection. but i think it s for latter, hence the method name.

intersectRayPlane

public static boolean intersectRayPlane(Vector3f theRayOrigin,
                                        Vector3f theRayDirection,
                                        Vector3f thePlanePointA,
                                        Vector3f thePlanePointB,
                                        Vector3f thePlanePointC,
                                        Vector3f theResult)
Deprecated. this method might contain errors.

Parameters:
theRayOrigin - Vector3f
theRayDirection - Vector3f
thePlanePointA - Vector3f
thePlanePointB - Vector3f
thePlanePointC - Vector3f
theResult - Vector3f
Returns:
boolean

intersectRayPlane

public static boolean intersectRayPlane(Ray3f theRay,
                                        Plane3f thePlane,
                                        Vector3f theResult)
Deprecated. this method might contain errors.

Parameters:
theRay - Ray3f
thePlane - Plane3f
theResult - Vector3f
Returns:
boolean

intersectRayPlane

public static float intersectRayPlane(Ray3f theRay,
                                      Plane3f thePlane)
Deprecated. this method might contain errors.

Parameters:
theRay - Ray3f
thePlane - Plane3f
Returns:
float

intersectRayTriangle

public static boolean intersectRayTriangle(Vector3f theRayOrigin,
                                           Vector3f theRayDirection,
                                           Vector3f theVertex0,
                                           Vector3f theVertex1,
                                           Vector3f theVertex2,
                                           Intersection.Result theResult,
                                           boolean theCullingFlag)
Fast, Minimum Storage Ray-Triangle Intersection by Tomas Moeller & Ben Trumbore http://jgt.akpeters.com/papers/MollerTrumbore97/code.html

Parameters:
theRayOrigin - Vector3f
theRayDirection - Vector3f
theVertex0 - Vector3f
theVertex1 - Vector3f
theVertex2 - Vector3f
theResult - Result
theCullingFlag - boolean
Returns:
boolean

intersectRayTriangle

public static float intersectRayTriangle(Vector3f theRayOrigin,
                                         Vector3f theRayDirection,
                                         Vector3f thePlanePointA,
                                         Vector3f thePlanePointB,
                                         Vector3f thePlanePointC,
                                         Vector3f theResult,
                                         boolean theCullingFlag)

RaySphere

public static boolean RaySphere(Vector3f p1,
                                Vector3f p2,
                                Vector3f sc,
                                float r)
http://local.wasp.uwa.edu.au/~pbourke/geometry/sphereline/raysphere.c Calculate the intersection of a ray and a sphere The line segment is defined from p1 to p2 The sphere is of radius r and centered at sc There are potentially two points of intersection given by p = p1 + mu1 (p2 - p1) p = p1 + mu2 (p2 - p1) Return FALSE if the ray doesn't intersect the sphere.


lineLineIntersect

public static int lineLineIntersect(Vector2f aBegin,
                                    Vector2f aEnd,
                                    Vector2f bBegin,
                                    Vector2f bEnd,
                                    Vector2f theIntersection)

lineLineIntersect

public static boolean lineLineIntersect(Vector3f p1,
                                        Vector3f p2,
                                        Vector3f p3,
                                        Vector3f p4,
                                        Vector3f pa,
                                        Vector3f pb,
                                        float[] theResult)
from paul bourke ( http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline3d/ ) Calculate the line segment PaPb that is the shortest route between two lines P1P2 and P3P4. Calculate also the values of mua and mub where Pa = P1 + mua (P2 - P1) Pb = P3 + mub (P4 - P3) Return FALSE if no solution exists.


main

public static void main(java.lang.String[] args)


processing library gestalt_p5 by Patrick Kochlik + Dennis Paul. (c) 2009