Module org.dyn4j

Interface Shape

    • Method Detail

      • getId

        @Deprecated
        java.util.UUID getId()
        Deprecated.
        ID schemes should be implemented by the user where needed; since 3.4.0
        Returns the unique identifier for this shape instance.
        Returns:
        UUID
      • 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:
        java.lang.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:
        java.lang.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:
        java.lang.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
      • createAABB

        AABB createAABB​(Transform transform)
        Creates an AABB from this Shape after applying the given transformation to the shape.
        Parameters:
        transform - the Transform for this Shape
        Returns:
        AABB the AABB enclosing this Shape
        Throws:
        java.lang.NullPointerException - if the given transform is null
        Since:
        3.0.0