Package gaiasky.util.math
Class Intersectord
java.lang.Object
gaiasky.util.math.Intersectord
public class Intersectord
extends java.lang.Object
-
Constructor Summary
Constructors Constructor Description Intersectord() -
Method Summary
Modifier and Type Method Description static booleancheckIntersectRaySpehre(double px, double py, double pz, double vx, double vy, double vz, double cx, double cy, double cz, double sphereRadius)static booleancheckIntersectRaySpehre(com.badlogic.gdx.math.Vector3 linePoint0, com.badlogic.gdx.math.Vector3 linePoint1, Vector3d sphereCenter, double sphereRadius)static booleancheckIntersectRaySpehre(Vector3d linePoint0, Vector3d linePoint1, Vector3d sphereCenter, double sphereRadius)static booleancheckIntersectSegmentSphere(Vector3d linePoint0, Vector3d linePoint1, Vector3d sphereCenter, double sphereRadius)static doubledistanceLinePoint(Vector3d x1, Vector3d x2, Vector3d x0)Returns the shortest distance between the line defined by x1 and x2 and the point x0.static doubledistanceSegmentPoint(Vector3d a, Vector3d b, Vector3d v)Calculates the euclidean distance from a point to a line segment.static booleanintersectRayBoundsFast(Rayd ray, Vector3d center, Vector3d dimensions)Quick check whether the givenRayandBoundingBoxdintersect.static com.badlogic.gdx.utils.Array<Vector3d>intersectRaySphere(Vector3d linePoint0, Vector3d linePoint1, Vector3d sphereCenter, double sphereRadius)static com.badlogic.gdx.utils.Array<Vector3d>intersectSegmentSphere(Vector3d linePoint0, Vector3d linePoint1, Vector3d sphereCenter, double sphereRadius)TODO: Not working well due to aux vectorsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Intersectord
public Intersectord()
-
-
Method Details
-
intersectRayBoundsFast
Quick check whether the givenRayandBoundingBoxdintersect.- Parameters:
ray- The raycenter- The center of the bounding boxdimensions- The dimensions (width, height and depth) of the bounding box- Returns:
- Whether the ray and the bounding box intersect.
-
checkIntersectRaySpehre
-
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
-
checkIntersectSegmentSphere
-
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- Parameters:
linePoint0-linePoint1-sphereCenter-sphereRadius-- Returns:
-
distanceLinePoint
Returns the shortest distance between the line defined by x1 and x2 and the point x0. See here.- Parameters:
x1- Segment first pointx2- Segment second pointx0- Point to test- Returns:
- The minimum distance between the line and the point
-
distanceSegmentPoint
Calculates the euclidean distance from a point to a line segment.- Parameters:
v- the pointa- start of line segmentb- end of line segment- Returns:
- distance from v to line segment [a,b]
-