Package teilchen.util
Class Intersection
- java.lang.Object
-
- teilchen.util.Intersection
-
- All Implemented Interfaces:
java.io.Serializable
public final class Intersection extends java.lang.Object implements java.io.Serializable
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
Nested Classes Modifier and Type Class Description static class
Intersection.IntersectionResult
-
Field Summary
Fields Modifier and Type Field Description static int
COINCIDENT
from paul bourke ( http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ )static int
INTERSECTING
static int
NOT_INTERSECTING
static int
PARALLEL
-
Constructor Summary
Constructors Constructor Description Intersection()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static float
intersectLinePlane(Ray3f pRay, Plane3f pPlane, processing.core.PVector pIntersectionPoint)
intersect line with plane ( grabbed from Xith )static boolean
intersectRayPlane(Ray3f pRay, Plane3f pPlane, processing.core.PVector pResult, boolean doPlanar, boolean quad)
static processing.core.PVector[]
intersectRaySpherePoints(processing.core.PVector pSphereCenter, float pSphereRadius, processing.core.PVector pRayDirection, processing.core.PVector pRayOrigin)
static boolean
intersectRayTriangle(processing.core.PVector pRayOrigin, processing.core.PVector pRayDirection, processing.core.PVector v0, processing.core.PVector v1, processing.core.PVector v2, processing.core.PVector pIntersectionPoint)
static boolean
intersectRayTriangle(processing.core.PVector pRayOrigin, processing.core.PVector pRayDirection, processing.core.PVector v0, processing.core.PVector v1, processing.core.PVector v2, Intersection.IntersectionResult pResult, boolean pCullingFlag)
Fast, Minimum Storage Ray-Triangle Intersection by Tomas Moeller & Ben Trumbore http://jgt.akpeters.com/papers/MollerTrumbore97/code.htmlstatic int
lineLineIntersect(processing.core.PVector aBegin, processing.core.PVector aEnd, processing.core.PVector bBegin, processing.core.PVector bEnd, processing.core.PVector pIntersection)
static boolean
lineLineIntersect(processing.core.PVector pP1, processing.core.PVector pP2, processing.core.PVector pP3, processing.core.PVector pP4, processing.core.PVector pPa, processing.core.PVector pPb)
from paul bourke ( http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline3d/ )static boolean
RaySphere(processing.core.PVector pP1, processing.core.PVector pP2, processing.core.PVector pSphereCenter, float pSphereRadius)
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.
-
-
-
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
-
INTERSECTING
public static final int INTERSECTING
- See Also:
- Constant Field Values
-
NOT_INTERSECTING
public static final int NOT_INTERSECTING
- See Also:
- Constant Field Values
-
-
Method Detail
-
intersectRayPlane
public static boolean intersectRayPlane(Ray3f pRay, Plane3f pPlane, processing.core.PVector pResult, boolean doPlanar, boolean quad)
-
intersectRayTriangle
public static boolean intersectRayTriangle(processing.core.PVector pRayOrigin, processing.core.PVector pRayDirection, processing.core.PVector v0, processing.core.PVector v1, processing.core.PVector v2, processing.core.PVector pIntersectionPoint)
-
intersectLinePlane
public static float intersectLinePlane(Ray3f pRay, Plane3f pPlane, processing.core.PVector pIntersectionPoint)
intersect line with plane ( grabbed from Xith )- Parameters:
pPlane
- Plane3fpRay
- Ray3fpIntersectionPoint
- PVector- Returns:
- float
-
intersectRayTriangle
public static boolean intersectRayTriangle(processing.core.PVector pRayOrigin, processing.core.PVector pRayDirection, processing.core.PVector v0, processing.core.PVector v1, processing.core.PVector v2, Intersection.IntersectionResult pResult, boolean pCullingFlag)
Fast, Minimum Storage Ray-Triangle Intersection by Tomas Moeller & Ben Trumbore http://jgt.akpeters.com/papers/MollerTrumbore97/code.html- Parameters:
pRayOrigin
- ray originpRayDirection
- ray directionv0
- triangle v0v1
- triangle v1v2
- triangle v2pResult
- interesction result containerpCullingFlag
- culling- Returns:
- returns true if intersections exists
-
RaySphere
public static boolean RaySphere(processing.core.PVector pP1, processing.core.PVector pP2, processing.core.PVector pSphereCenter, float pSphereRadius)
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.- Parameters:
pP1
- P1pP2
- P2pSphereCenter
- sphere centerpSphereRadius
- sphere radius- Returns:
- returns true if intersection exists
-
lineLineIntersect
public static int lineLineIntersect(processing.core.PVector aBegin, processing.core.PVector aEnd, processing.core.PVector bBegin, processing.core.PVector bEnd, processing.core.PVector pIntersection)
-
lineLineIntersect
public static boolean lineLineIntersect(processing.core.PVector pP1, processing.core.PVector pP2, processing.core.PVector pP3, processing.core.PVector pP4, processing.core.PVector pPa, processing.core.PVector pPb)
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.
- Parameters:
pP1
- P1pP2
- P2pP3
- P3pP4
- P4pPa
- PapPb
- Pb- Returns:
- sucess if solution exists
-
intersectRaySpherePoints
public static processing.core.PVector[] intersectRaySpherePoints(processing.core.PVector pSphereCenter, float pSphereRadius, processing.core.PVector pRayDirection, processing.core.PVector pRayOrigin)
-
-