Interface MArea

All Superinterfaces:
Area

public interface MArea
extends Area
Interface for areas in XY-plane. The area object is an enclosed area of 2D space that can have holes. This interface allows modification of areas.
Since:
9.10.2
  • Method Summary

    Modifier and Type Method Description
    void add​(Area area)
    Adds the given shape of the specified area to the shape of this area.
    boolean clean​(double tolerance)
    Cleans the area from near points based on the given tolerance value.
    static MArea create()
    Returns an empty area.
    static MArea create​(Area area)
    Creates an area with the given area.
    static MArea create​(Polygon2d polygon, double offset)
    Creates an area with the given polygon and resize value.
    static MArea create​(Shape shape)
    Creates an area with the given Shape.
    static MArea create​(Collection<? extends Area> areas)
    Creates an union area with the given areas.
    static MArea create​(List<? extends Vector2d> polygonPoints)
    Creates an area with the given polygon points.
    void intersect​(Area area)
    Sets the shape of this area to the intersection of its current shape and the shape of the given specified area.
    void removeHoles()
    Removes the holes from this area.
    void reset()
    Removes all of the geometry from this area and restores it to an empty area.
    void resize​(double offset)
    Resizes the area with the given offset value.
    void resize​(double offset, boolean roundCorners)
    Resizes the area with the given offset value.
    void scale​(double multiplier)
    Scales the area with the given value.
    void subtract​(Area area)
    Subtracts the shape of the specified area from the shape of this area.
  • Method Details

    • create

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

      static MArea 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 MArea 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 MArea 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 MArea create​(Polygon2d polygon, double offset)
      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
      offset - the amount of resize used for creating the returned area
      Returns:
      the area with the given resized polygon
      Since:
      9.10.2
    • create

      static MArea 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
    • add

      void add​(Area area)
      Adds the given shape of the specified area to the shape of this area. The resulting shape of this area will include the union of both shapes, or all areas that were contained in either this or the specified area.
      Parameters:
      area - the area to be added to the current area
      Throws:
      NullPointerException - if area is null
      Since:
      9.10.2
    • clean

      boolean clean​(double tolerance)
      Cleans the area from near points based on the given tolerance value.
      Parameters:
      tolerance - the tolerance between points and segments of the area that is used to clean the area
      Returns:
      true if cleaning happened, false otherwise
      Since:
      9.10.2
    • intersect

      void intersect​(Area area)
      Sets the shape of this area to the intersection of its current shape and the shape of the given specified area. The resulting shape of this area will include only areas that were contained in both this area and in the specified area.
      Parameters:
      area - the area to be intersected with current area
      Throws:
      NullPointerException - if area is null
      Since:
      9.10.2
    • reset

      void reset()
      Removes all of the geometry from this area and restores it to an empty area.
      Since:
      9.10.2
    • scale

      void scale​(double multiplier)
      Scales the area with the given value. Scaling keeps the centroid of the area unchanged.
      Parameters:
      multiplier - the value that is used to scale the area
      Since:
      9.10.2
    • resize

      void resize​(double offset)
      Resizes the area with the given offset value. The offset is a value that will enlarge or reduce the area-polygon.
      Parameters:
      offset - the offset that is used to resize the area
      Since:
      9.10.2
    • resize

      void resize​(double offset, boolean roundCorners)
      Resizes the area with the given offset value. The offset is a value that will enlarge or reduce the area-polygon.
      Parameters:
      offset - the offset that is used to resize the area
      roundCorners - if true, use an intermediate point to round sharp corners
      Since:
      9.10.2
    • subtract

      void subtract​(Area area)
      Subtracts the shape of the specified area from the shape of this area. The resulting shape of this area will include areas that were contained only in this area and not in the specified area.
      Parameters:
      area - the area to be subtracted from the current area
      Throws:
      NullPointerException - if area is null
      Since:
      9.10.2
    • removeHoles

      void removeHoles()
      Removes the holes from this area.
      Since:
      9.10.2