Class Intersectord


public class Intersectord extends Object
  • Constructor Details

    • Intersectord

      public Intersectord()
  • Method Details

    • intersectRayBoundsFast

      public static boolean intersectRayBoundsFast(Rayd ray, Vector3d center, Vector3d dimensions)
      Quick check whether the given Ray and BoundingBoxd intersect.
      ray - The ray
      center - The center of the bounding box
      dimensions - The dimensions (width, height and depth) of the bounding box
      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)
    • intersectSegmentSphere

      public static com.badlogic.gdx.utils.Array<Vector3d> intersectSegmentSphere(Vector3d linePoint0, Vector3d linePoint1, Vector3d sphereCenter, double sphereRadius)
      TODO: Not working well due to aux vectors
      linePoint0 -
      linePoint1 -
      sphereCenter -
      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.
      x1 - Segment first point
      x2 - Segment second point
      x0 - Point to test
      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.
      v - the point
      a - start of line segment
      b - end of line segment
      distance from v to line segment [a,b]
    • intersectRayPlane

      public static boolean intersectRayPlane(Rayd ray, Planed plane, Vector3d intersection)
      Intersects a Rayd and a Planed. The intersection point is stored in intersection in case an intersection is present.
      intersection - The vector the intersection point is written to (optional)
      Whether an intersection is present.
    • intersectLinePlane

      public static double intersectLinePlane(float x, float y, float z, float x2, float y2, float z2, Planed plane, Vector3d intersection)
      Intersects a line and a plane. The intersection is returned as the distance from the first point to the plane. In case an intersection happened, the return value is in the range [0,1]. The intersection point can be recovered by point1 + t * (point2 - point1) where t is the return value of this method.
    • intersectLinePlane

      public static double intersectLinePlane(Vector3d p0, Vector3d p1, Vector3d point, Vector3d normal, Vector3d intersection)
      p0 - First point of the line.
      p1 - Second point of the line.
      point - A point on the plane.
      normal - The normal vector defining the plane direction.
      intersection - The ouput vector.
      A vector, or null.
    • lineIntersection

      public static double 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.
      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.
      The point of intersection between the line and the plane, null if the line is parallel to the plane.