Interface Area

  • All Known Subinterfaces:
    MArea

    public interface Area
    Read-only interface for handling areas in XY-plane. The area object is an enclosed area of 2D space that can have holes.
    Since:
    9.10.2
    • Method Detail

      • create

        static Area create()
        Returns an empty area.
        Returns:
        an empty area.
        Since:
        9.10.2
      • create

        static Area create​(List<? extends Vector2d> polygonPoints)
        Creates an area with the given polygon points. The area does not take ownership of the given points.
        Parameters:
        polygonPoints - the points used for creating the area
        Returns:
        an area with the given polygon points
        Since:
        9.10.2
      • create

        static Area create​(Area area)
        Creates an area with the given area. The returned area does not take ownership of the given area.
        Parameters:
        area - the area used for creating the returned area
        Returns:
        an area with the given area
        Since:
        9.10.2
      • create

        static Area create​(Polygon2d polygon,
                           double resize)
        Creates an area with the given polygon and resize value. The returned area does not take ownership of the given polygon.
        Parameters:
        polygon - the polygon used for creating the returned area
        resize - the amount of resize used for creating the returned area
        Returns:
        the area with the given resized polygon
        Since:
        9.10.2
      • create

        static Area create​(Collection<? extends Area> areas)
        Creates an union area with the given areas. The returned area does not take ownership of the given areas. The resulting shape of this area will include the union of all shapes, or all areas that were contained in either this or the specified areas.
        Parameters:
        areas - the areas used for creating the returned area
        Returns:
        an area with the given area
        Since:
        9.10.2
      • create

        static Area create​(Shape shape)
        Creates an area with the given Shape. The returned area does not take ownership of the given area.
        Parameters:
        shape - the shape used for creating the returned area
        Returns:
        an area with the given area
        Since:
        9.10.2
      • contains

        boolean contains​(Vector2d point)
        Checks if the area contains the given point.
        Parameters:
        point - the point
        Returns:
        true if the point is located inside the area, false otherwise
        Since:
        9.10.2
      • getMinimumBoundingRectangle

        Rectangle2d getMinimumBoundingRectangle()
        Returns the minimum area bounding rectangle. Note: Don't use this with empty areas.
        Returns:
        the minimum area bounding rectangle
        Since:
        9.10.2
      • getSize

        double getSize()
        Returns the size of the area.
        Returns:
        the size of the area
        Since:
        9.10.2
      • getHoles

        List<MPolygon2d> getHoles()
        Returns a list of holes in the area.
        Returns:
        list of holes in the area
        Since:
        9.10.2
      • getLargestPolygon

        MPolygon2d getLargestPolygon()
        Returns the largest outer polygon of the area.
        Returns:
        the largest polygon
        Since:
        9.10.2
      • getPolygons

        List<MPolygon2d> getPolygons()
        Returns a list of polygons in the area.
        Returns:
        list of polygons in the area
        Since:
        9.10.2
      • getVertices

        List<MVector2d> getVertices()
        Returns a list of vertices in the area.
        Returns:
        list of vertices in the area
        Since:
        9.10.2
      • isEmpty

        boolean isEmpty()
        Tests whether this area object encloses any area.
        Returns:
        true if this area represents an empty area, false otherwise
        Since:
        9.10.2
      • isSingular

        boolean isSingular()
        Tests whether this area is comprised of a single closed subpath. This method returns true if the path contains 0 or 1 subpaths, or false if the path contains more than 1 subpath.
        Returns:
        true if the area is comprised of a single basic geometry, false otherwise
        Since:
        9.10.2
      • getBoundingRectangle

        MAABB2d getBoundingRectangle()
        Returns a copy of a bounding rectangle which has minimum area and is axis aligned.
        Returns:
        bounding rectangle
        Since:
        9.10.2
      • getCentroid

        MVector2d getCentroid()
        Returns the centroid of this area. The centroid is the center of mass. For an empty area this returns (0, 0).
        Returns:
        the centroid of this area
        Since:
        9.10.2