Module org.dyn4j

Interface Shape

    • Method Detail

      • getCenter

        Vector2 getCenter()
        Returns the center/centroid of the Shape in local coordinates.
        Returns:
        Vector2
      • getRadius

        double getRadius()
        Returns the maximum radius of the shape from the center.
        Returns:
        double
        Since:
        2.0.0
      • getRadius

        double getRadius​(Vector2 center)
        Returns the radius of the shape if the given point was the center for this shape.
        Parameters:
        center - the center point
        Returns:
        double
        Throws:
        NullPointerException - if the given point is null
        Since:
        3.0.2
      • rotateAboutCenter

        void rotateAboutCenter​(double theta)
        Rotates the Shape about it's center.

        This method replaced the overriding functionality of the rotate method from the Transformable interface.

        Parameters:
        theta - the rotation angle in radians
        Since:
        3.1.1
      • contains

        boolean contains​(Vector2 point)
        Returns true if the given point is inside this Shape.

        If the given point lies on an edge the point is considered to be inside the Shape.

        The given point is assumed to be in world space.

        This is the same as calling contains(Vector2, Transform) and passing a new Transform.

        Parameters:
        point - world space point
        Returns:
        boolean
        Throws:
        NullPointerException - if the given point is null
        Since:
        3.1.5
      • contains

        boolean contains​(Vector2 point,
                         Transform transform)
        Returns true if the given point is inside this Shape.

        If the given point lies on an edge the point is considered to be inside the Shape.

        The given point is assumed to be in world space.

        Parameters:
        point - world space point
        transform - Transform for this Shape
        Returns:
        boolean
        Throws:
        NullPointerException - if the given point or transform is null
      • createMass

        Mass createMass​(double density)
        Creates a Mass object using the geometric properties of this Shape and the given density.
        Parameters:
        density - the density in kg/m2
        Returns:
        Mass the Mass of this Shape
      • computeAABB

        void computeAABB​(Transform transform,
                         AABB aabb)
        Computes the AABB from this Shape after applying the given transformation and places the result in the given AABB.
        Parameters:
        transform - the Transform for this Shape
        aabb - the destination AABB
        Throws:
        NullPointerException - if the given transform is null
        Since:
        4.0.0