Class Intersection3D_F64

java.lang.Object
georegression.metric.Intersection3D_F64

public class Intersection3D_F64 extends Object
Functions for finding the intersection of different 3D objects
  • Constructor Details

    • Intersection3D_F64

      public Intersection3D_F64()
  • Method Details

    • intersection

      public static boolean intersection(PlaneNormal3D_F64 plane, LineParametric3D_F64 line, Point3D_F64 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) Plane
      line - (Input) Line
      intersection - (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_F64 plane, LineParametric3D_F64 line, Point3D_F64 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) Plane
      line - (Input) Line
      intersection - (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_F64 a, PlaneGeneral3D_F64 b, LineParametric3D_F64 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) Plane
      b - (Input) Plane
      line - (Output) Intersection.
      Returns:
      true if they intersect ata line or false if not
    • intersection

      public static int intersection(Triangle3D_F64 T, LineSegment3D_F64 R, Point3D_F64 output)

      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 space
      R - (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_F64 T, LineSegment3D_F64 R, Point3D_F64 output, Vector3D_F64 u, Vector3D_F64 v, Vector3D_F64 n, Vector3D_F64 dir, Vector3D_F64 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 space
      R - (Input) Line segment in 3D space.
      output - (Output) Storage for the intersection, if there is one
      u - (internal use) triangle vectors
      v - (internal use) triangle vectors
      n - (internal use) triangle vectors
      dir - (internal use) ray vector
      w0 - (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

      public static int intersection(Triangle3D_F64 T, LineParametric3D_F64 R, Point3D_F64 output)

      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 space
      R - (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_F64 T, LineParametric3D_F64 R, Point3D_F64 output, Vector3D_F64 u, Vector3D_F64 v, Vector3D_F64 n, Vector3D_F64 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 space
      R - (Input) Line segment in 3D space.
      output - (Output) Storage for the intersection, if there is one
      u - (internal use) triangle vectors
      v - (internal use) triangle vectors
      n - (internal use) triangle vectors
      w0 - (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_F64> polygon, LineParametric3D_F64 line, Point3D_F64 output, Vector3D_F64 n, Vector3D_F64 u, Vector3D_F64 v, Vector3D_F64 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_F64> polygon, LineParametric3D_F64 line, Point3D_F64 output)
      See Also:
    • contained

      public static boolean contained(BoxLength3D_F64 box, Point3D_F64 point)
      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 - Box
      point - Point which is tested to see if it is inside the box
      Returns:
      true for inside and false for not
    • contained

      public static boolean contained(Box3D_F64 box, Point3D_F64 point)

      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 - Box
      point - Point which is tested to see if it is inside the box
      Returns:
      true for inside and false for not
    • contained2

      public static boolean contained2(Box3D_F64 box, Point3D_F64 point)

      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 - Box
      point - Point which is tested to see if it is inside the box
      Returns:
      true for inside and false for not
    • contained

      public static boolean contained(Box3D_F64 boxA, Box3D_F64 boxB)
      Returns true if boxB is contained inside of or is identical to boxA.
      Parameters:
      boxA - Box
      boxB - Box which is being tested to see if it is inside of boxA
      Returns:
      true if inside/identical or false if outside
    • intersectionArea

      public static double intersectionArea(Box3D_F64 a, Box3D_F64 b)
      Returns the area of the intersection of two 3D boces.
      Parameters:
      a - Box3D
      b - Box3D
      Returns:
      area of intersection
    • intersection

      public static boolean intersection(Box3D_F64 boxA, Box3D_F64 boxB)
      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 - Box
      boxB - Box
      Returns:
      true for intersection and false if no intersection
    • intersection

      protected static boolean intersection(double a0, double b0, double a1, double b1)
    • intersection

      public static boolean intersection(LineParametric3D_F64 line, Sphere3D_F64 sphere, Point3D_F64 a, Point3D_F64 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 - line
      sphere - sphere
      a - (Output) Storage for point of intersection. t = max(t0,t1), where t is location on line
      b - (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_F64 ray, Cylinder3D_F64 cylinder, Point3D_F64 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