Class IntersectorDouble

java.lang.Object
gaiasky.util.math.IntersectorDouble

public class IntersectorDouble extends Object
  • Constructor Details

    • IntersectorDouble

      public IntersectorDouble()
  • Method Details

    • intersectRayBoundsFast

      public static boolean intersectRayBoundsFast(RayDouble ray, Vector3d center, Vector3d dimensions)
      Quick check whether the given Ray and BoundingBoxDouble intersect.
      Parameters:
      ray - The ray
      center - The center of the bounding box
      dimensions - The dimensions (width, height and depth) of the bounding box
      Returns:
      Whether the ray and the bounding box intersect.
    • checkIntersectRaySpehre

      public static boolean checkIntersectRaySpehre(Vector3d linePoint0, Vector3d linePoint1, Vector3d sphereCenter, double sphereRadius)
    • checkIntersectRaySpehre

      public static boolean checkIntersectRaySpehre(com.badlogic.gdx.math.Vector3 linePoint0, com.badlogic.gdx.math.Vector3 linePoint1, Vector3d sphereCenter, double sphereRadius)
    • checkIntersectRaySpehre

      public static boolean checkIntersectRaySpehre(double px, double py, double pz, double vx, double vy, double vz, double cx, double cy, double cz, double sphereRadius)
    • intersectRaySphere

      public static com.badlogic.gdx.utils.Array<Vector3d> intersectRaySphere(Vector3d linePoint0, Vector3d linePoint1, Vector3d sphereCenter, double sphereRadius)
    • checkIntersectSegmentSphere

      public static boolean checkIntersectSegmentSphere(Vector3d linePoint0, Vector3d linePoint1, Vector3d sphereCenter, double sphereRadius)
    • distanceLinePoint

      public static double distanceLinePoint(Vector3d x1, Vector3d x2, Vector3d x0)
      Returns the shortest distance between the line defined by x1 and x2 and the point x0. See here.
      Parameters:
      x1 - Segment first point
      x2 - Segment second point
      x0 - Point to test
      Returns:
      The minimum distance between the line and the point
    • distanceSegmentPoint

      public static double distanceSegmentPoint(Vector3d a, Vector3d b, Vector3d v)
      Calculates the Euclidean distance from a point to a line segment.
      Parameters:
      a - start of line segment
      b - end of line segment
      v - the point
      Returns:
      distance from v to line segment [a,b]
    • lineIntersection

      public static void lineIntersection(Vector3d planePoint, Vector3d planeNormal, Vector3d linePoint, Vector3d lineDirection, Vector3d out)
      Determines the point of intersection between a plane defined by a point and a normal vector and a line defined by a point and a direction vector.
      Parameters:
      planePoint - A point on the plane.
      planeNormal - The normal vector of the plane.
      linePoint - A point on the line.
      lineDirection - The direction vector of the line.
    • distancePointPlane

      public static double distancePointPlane(Vector3d point, Vector3d planeNormal, Vector3d planePoint)
      Determine the signed distance of the given point to the plane determined by the given plane normal and point.
      Parameters:
      point - The point to test.
      planeNormal - The normal vector of the plane.
      planePoint - A point in the plane.
      Returns:
      the distance between the point and the plane.
    • distancePointPlane

      public static double distancePointPlane(double pointX, double pointY, double pointZ, double a, double b, double c, double d)
      Determine the signed distance of the given point (pointX, pointY, pointZ) to the plane specified via its general plane equation a*x + b*y + c*z + d = 0. From JOML (MIT license).
      Parameters:
      pointX - the x coordinate of the point
      pointY - the y coordinate of the point
      pointZ - the z coordinate of the point
      a - the x factor in the plane equation
      b - the y factor in the plane equation
      c - the z factor in the plane equation
      d - the constant in the plane equation
      Returns:
      the distance between the point and the plane
    • intersectLineSegmentPlane

      public static boolean intersectLineSegmentPlane(Vector3d p0, Vector3d p1, Vector3d planeNormal, Vector3d planePoint, Vector3d intersectionPoint)
      Determine whether the line segment with the end points (p0X, p0Y, p0Z) and (p1X, p1Y, p1Z) intersects the plane given as the normal and point, and return the point of intersection.
      Parameters:
      p0 - the line segment's first end point.
      p1 - the line segment's second end point.
      planeNormal - the plane normal.
      planePoint - the plane point.
      intersectionPoint - the point of intersection
      Returns:
      true if the given line segment intersects the plane; false otherwise
    • intersectLineSegmentPlane

      public static boolean intersectLineSegmentPlane(double p0X, double p0Y, double p0Z, double p1X, double p1Y, double p1Z, double a, double b, double c, double d, Vector3d intersectionPoint)
      Determine whether the line segment with the end points (p0X, p0Y, p0Z) and (p1X, p1Y, p1Z) intersects the plane given as the general plane equation a*x + b*y + c*z + d = 0, and return the point of intersection. This code is from JOML (MIT license).
      Parameters:
      p0X - the x coordinate of the line segment's first end point
      p0Y - the y coordinate of the line segment's first end point
      p0Z - the z coordinate of the line segment's first end point
      p1X - the x coordinate of the line segment's second end point
      p1Y - the y coordinate of the line segment's second end point
      p1Z - the z coordinate of the line segment's second end point
      a - the x factor in the plane equation
      b - the y factor in the plane equation
      c - the z factor in the plane equation
      d - the constant in the plane equation
      intersectionPoint - the point of intersection
      Returns:
      true if the given line segment intersects the plane; false otherwise