Module org.dyn4j

Class CircleDetector


  • public final class CircleDetector
    extends Object
    Class devoted to Circle detection queries.
    Since:
    2.0.0
    Version:
    3.2.0
    Author:
    William Bittle
    • Method Detail

      • detect

        public static final boolean detect​(Circle circle1,
                                           Transform transform1,
                                           Circle circle2,
                                           Transform transform2,
                                           Penetration penetration)
        Fast method for determining a collision between two Circles.

        Returns true if the given Circles are intersecting and places the penetration vector and depth in the given Penetration object.

        If the Circle centers are coincident then the penetration Vector2 will be the zero Vector2, however, the penetration depth will be correct. In this case its up to the caller to determine a reasonable penetration Vector2.

        Parameters:
        circle1 - the first Circle
        transform1 - the first Circle's Transform
        circle2 - the second Circle
        transform2 - the second Circle's Transform
        penetration - the Penetration object to fill
        Returns:
        boolean
      • detect

        public static final boolean detect​(Circle circle1,
                                           Transform transform1,
                                           Circle circle2,
                                           Transform transform2)
        Fast method for determining a collision between two Circles.

        Returns true if the given Circles are intersecting.

        Parameters:
        circle1 - the first Circle
        transform1 - the first Circle's Transform
        circle2 - the second Circle
        transform2 - the second Circle's Transform
        Returns:
        boolean true if the two circles intersect
      • raycast

        public static final boolean raycast​(Ray ray,
                                            double maxLength,
                                            Circle circle,
                                            Transform transform,
                                            Raycast raycast)
        Performs a ray cast against the given circle.
        Parameters:
        ray - the Ray
        maxLength - the maximum ray length
        circle - the Circle
        transform - the Circle's Transform
        raycast - the Raycast result
        Returns:
        boolean true if the ray intersects the circle
        Since:
        2.0.0