Class Intersection3D_F32
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
contained
(Box3D_F32 box, Point3D_F32 point) Returns true if the point is contained inside the box, with an exclusive upper extent.static boolean
Returns true if boxB is contained inside of or is identical to boxA.static boolean
contained
(BoxLength3D_F32 box, Point3D_F32 point) Returns true if the point is contained inside the box.static boolean
contained2
(Box3D_F32 box, Point3D_F32 point) Returns true if the point is contained inside the box, with an inclusive upper extent.static int
intersectConvex
(FastAccess<Point3D_F32> polygon, LineParametric3D_F32 line, Point3D_F32 output) static int
intersectConvex
(FastAccess<Point3D_F32> polygon, LineParametric3D_F32 line, Point3D_F32 output, Vector3D_F32 n, Vector3D_F32 u, Vector3D_F32 v, Vector3D_F32 w0) Detects if a 2D convex polygon that has been moved into a 3D world is intersected by the 3D line.protected static boolean
intersection
(float a0, float b0, float a1, float b1) static boolean
intersection
(LineParametric3D_F32 line, Sphere3D_F32 sphere, Point3D_F32 a, Point3D_F32 b) Finds the intersection of a line and sphere.static boolean
intersection
(PlaneGeneral3D_F32 plane, LineParametric3D_F32 line, Point3D_F32 intersection) Finds the intersection of a line and a plane.static boolean
Finds the line which is the intersection between the two planes.static boolean
intersection
(PlaneNormal3D_F32 plane, LineParametric3D_F32 line, Point3D_F32 intersection) Finds the intersection of a line and a plane.static boolean
intersection
(Box3D_F32 boxA, Box3D_F32 boxB) Returns true if the two boxs intersect each other.static int
intersection
(Triangle3D_F32 T, LineParametric3D_F32 R, Point3D_F32 output) Finds the intersection between a 3D triangle and a line.static int
intersection
(Triangle3D_F32 T, LineParametric3D_F32 R, Point3D_F32 output, Vector3D_F32 u, Vector3D_F32 v, Vector3D_F32 n, Vector3D_F32 w0) Finds the intersection between a 3D triangle and a line.static int
intersection
(Triangle3D_F32 T, LineSegment3D_F32 R, Point3D_F32 output) Finds the intersection between a 3D triangle and a line-segment.static int
intersection
(Triangle3D_F32 T, LineSegment3D_F32 R, Point3D_F32 output, Vector3D_F32 u, Vector3D_F32 v, Vector3D_F32 n, Vector3D_F32 dir, Vector3D_F32 w0) Finds the intersection between a 3D triangle and a line-segment.static boolean
intersection1
(LineParametric3D_F32 ray, Cylinder3D_F32 cylinder, Point3D_F32 output) Finds the intersection between the ray and the cylinder.static float
Returns the area of the intersection of two 3D boces.
-
Constructor Details
-
Intersection3D_F32
public Intersection3D_F32()
-
-
Method Details
-
intersection
public static boolean intersection(PlaneNormal3D_F32 plane, LineParametric3D_F32 line, Point3D_F32 intersection) Finds the intersection of a line and a plane. Returns true if they intersect at a unique point or false if there is no intersection or an infinite number of intersections.- Parameters:
plane
- (Input) Planeline
- (Input) Lineintersection
- (Output) Where the intersection is written to- Returns:
- True if the intersection is at a unique point. If false then no intersection or infinite.
-
intersection
public static boolean intersection(PlaneGeneral3D_F32 plane, LineParametric3D_F32 line, Point3D_F32 intersection) Finds the intersection of a line and a plane. Returns true if they intersect at a unique point or false if there is no intersection or an infinite number of intersections.- Parameters:
plane
- (Input) Planeline
- (Input) Lineintersection
- (Output) Where the intersection is written to- Returns:
- True if the intersection is at a unique point. If false then no intersection or infinite.
-
intersection
public static boolean intersection(PlaneGeneral3D_F32 a, PlaneGeneral3D_F32 b, LineParametric3D_F32 line) Finds the line which is the intersection between the two planes. For a valid solution to be returned the planes must not be parallel to each other. If the planes are parallel then the slope of the returned line will have a value of zero for each element.- Parameters:
a
- (Input) Planeb
- (Input) Planeline
- (Output) Intersection.- Returns:
- true if they intersect ata line or false if not
-
intersection
Finds the intersection between a 3D triangle and a line-segment. Code ported from [1].
[1] http://geomalgorithms.com/a06-_intersect-2.html
- Parameters:
T
- (Input) Triangle in 3D spaceR
- (Input) Line segment in 3D space.output
- (Output) Storage for the intersection, if there is one- Returns:
- -1 = triangle is degenerate (a segment or point)
0 = disjoint (no intersect)
1 = intersect in unique point I1
2 = are in the same plane
-
intersection
public static int intersection(Triangle3D_F32 T, LineSegment3D_F32 R, Point3D_F32 output, Vector3D_F32 u, Vector3D_F32 v, Vector3D_F32 n, Vector3D_F32 dir, Vector3D_F32 w0) Finds the intersection between a 3D triangle and a line-segment. Code ported from [1]. Internal working variables are provided in this interface to reduce memory creation/destruction.
[1] http://geomalgorithms.com/a06-_intersect-2.html
- Parameters:
T
- (Input) Triangle in 3D spaceR
- (Input) Line segment in 3D space.output
- (Output) Storage for the intersection, if there is oneu
- (internal use) triangle vectorsv
- (internal use) triangle vectorsn
- (internal use) triangle vectorsdir
- (internal use) ray vectorw0
- (internal use) ray vector- Returns:
- -1 = triangle is degenerate (a segment or point) 0 = disjoint (no intersect) 1 = intersect in unique point I1 2 = are in the same plane
-
intersection
Finds the intersection between a 3D triangle and a line. Code ported from [1]. Internal working variables are provided in this interface to reduce memory creation/destruction.
[1] http://geomalgorithms.com/a06-_intersect-2.html
- Parameters:
T
- (Input) Triangle in 3D spaceR
- (Input) Line segment in 3D space.output
- (Output) Storage for the intersection, if there is one- Returns:
- -1 = triangle is degenerate (a segment or point)
- 0 = disjoint (no intersect)
- 1 = intersect in unique point. Positive direction or zero
- 2 = are in the same plane
- 3 = intersect in unique point. Negative direction
-
intersection
public static int intersection(Triangle3D_F32 T, LineParametric3D_F32 R, Point3D_F32 output, Vector3D_F32 u, Vector3D_F32 v, Vector3D_F32 n, Vector3D_F32 w0) Finds the intersection between a 3D triangle and a line. Code ported from [1]. Internal working variables are provided in this interface to reduce memory creation/destruction.
[1] http://geomalgorithms.com/a06-_intersect-2.html
- Parameters:
T
- (Input) Triangle in 3D spaceR
- (Input) Line segment in 3D space.output
- (Output) Storage for the intersection, if there is oneu
- (internal use) triangle vectorsv
- (internal use) triangle vectorsn
- (internal use) triangle vectorsw0
- (internal use) ray vector- Returns:
- -1 = triangle is degenerate (a segment or point)
- 0 = disjoint (no intersect)
- 1 = intersect in unique point. Positive direction or zero
- 2 = are in the same plane
- 3 = intersect in unique point. Negative direction
-
intersectConvex
public static int intersectConvex(FastAccess<Point3D_F32> polygon, LineParametric3D_F32 line, Point3D_F32 output, Vector3D_F32 n, Vector3D_F32 u, Vector3D_F32 v, Vector3D_F32 w0) Detects if a 2D convex polygon that has been moved into a 3D world is intersected by the 3D line.Transformation: 1) Each 2D point is converted into 3D: X=(x,y,0) 2) X' = R*X + T, where (R,T) are a rigid body transform from poly to world frames
- Parameters:
polygon
- (Input) Convex polygon. All points must lie on a plane.line
- (Input) Line.output
- (Output) Point of intersection (if any)n
- (internal use)u
- (internal use)v
- (internal use)w0
- (internal use)- Returns:
- -1 = triangle is degenerate (a segment or point)
- 0 = disjoint (no intersect)
- 1 = intersect in unique point. Positive direction or zero
- 2 = are in the same plane
- 3 = intersect in unique point. Negative direction
-
intersectConvex
public static int intersectConvex(FastAccess<Point3D_F32> polygon, LineParametric3D_F32 line, Point3D_F32 output) -
contained
Returns true if the point is contained inside the box. The point is considered to be inside the box if the following test passes for each dimension. box.x ≤ point.x<
box.x + box.lengthX- Parameters:
box
- Boxpoint
- Point which is tested to see if it is inside the box- Returns:
- true for inside and false for not
-
contained
Returns true if the point is contained inside the box, with an exclusive upper extent. The point is considered to be inside the box if the following test passes:
box.p0.x ≤ point.x<
box.p1.x
box.p0.y ≤ point.y<
box.p1.y
box.p0.z ≤ point.z<
box.p1.z
- Parameters:
box
- Boxpoint
- Point which is tested to see if it is inside the box- Returns:
- true for inside and false for not
-
contained2
Returns true if the point is contained inside the box, with an inclusive upper extent. The point is considered to be inside the box if the following test passes:
box.p0.x ≤ point.x ≤ box.p1.x
box.p0.y ≤ point.y ≤ box.p1.y
box.p0.z ≤ point.z ≤ box.p1.z
- Parameters:
box
- Boxpoint
- Point which is tested to see if it is inside the box- Returns:
- true for inside and false for not
-
contained
Returns true if boxB is contained inside of or is identical to boxA.- Parameters:
boxA
- BoxboxB
- Box which is being tested to see if it is inside of boxA- Returns:
- true if inside/identical or false if outside
-
intersectionArea
Returns the area of the intersection of two 3D boces.- Parameters:
a
- Box3Db
- Box3D- Returns:
- area of intersection
-
intersection
Returns true if the two boxs intersect each other. p0 is inclusive and p1 is exclusive. So if the p0 edge and p1 edge overlap perfectly there is no intersection.- Parameters:
boxA
- BoxboxB
- Box- Returns:
- true for intersection and false if no intersection
-
intersection
protected static boolean intersection(float a0, float b0, float a1, float b1) -
intersection
public static boolean intersection(LineParametric3D_F32 line, Sphere3D_F32 sphere, Point3D_F32 a, Point3D_F32 b) Finds the intersection of a line and sphere. There can be 0, 1, or 2 intersections. If there is 1 intersection the same point is returned twice.- Parameters:
line
- linesphere
- spherea
- (Output) Storage for point of intersection. t = max(t0,t1), where t is location on lineb
- (Output) Storage for point of intersection. t = max(t0,t1), where t is location on line- Returns:
- true if the line intersects the sphere
-
intersection1
public static boolean intersection1(LineParametric3D_F32 ray, Cylinder3D_F32 cylinder, Point3D_F32 output) Finds the intersection between the ray and the cylinder. If there are two points of intersection then the point closest to the ray's origin is returned. If there are infinite or no intersections then false is returned. Points "behind" the ray are ignored.- Returns:
- true if one valid intersection was found
-