Documentation of 'math.geom2d.polygon.MultiPolygon2D' Java class
MultiPolygon2D
math.geom2d.polygon

Class MultiPolygon2D

    • Constructor Detail

      • MultiPolygon2D

        public MultiPolygon2D()
      • MultiPolygon2D

        public MultiPolygon2D(int nRings)
        Ensures the inner buffer has enough capacity for storing the required number of rings.
      • MultiPolygon2D

        public MultiPolygon2D(LinearRing2D... rings)
      • MultiPolygon2D

        public MultiPolygon2D(Polygon2D polygon)
      • MultiPolygon2D

        public MultiPolygon2D(java.util.Collection<LinearRing2D> lines)
    • Method Detail

      • insertRing

        public void insertRing(int index,
                               LinearRing2D ring)
      • clearRings

        public void clearRings()
      • setRing

        public void setRing(int index,
                            LinearRing2D ring)
      • ringNumber

        public int ringNumber()
      • area

        public double area()
        Computes the signed area of the polygon.
        Specified by:
        area in interface Polygon2D
        Returns:
        the signed area of the polygon.
        Since:
        0.9.1
      • centroid

        public Point2D centroid()
        Computes the centroid (center of mass) of the polygon.
        Specified by:
        centroid in interface Polygon2D
        Returns:
        the centroid of the polygon
        Since:
        0.9.1
      • edges

        public java.util.Collection<LineSegment2D> edges()
        Description copied from interface: Polygon2D
        Return the edges as line segments of the polygon
        Specified by:
        edges in interface Polygon2D
      • edgeNumber

        public int edgeNumber()
        Description copied from interface: Polygon2D
        Returns the number of edges of the polygon
        Specified by:
        edgeNumber in interface Polygon2D
      • vertices

        public java.util.Collection<Point2D> vertices()
        Description copied from interface: Polygon2D
        Returns the vertices (singular points) of the polygon
        Specified by:
        vertices in interface Polygon2D
      • vertex

        public Point2D vertex(int i)
        Returns the i-th vertex of the polygon.
        Specified by:
        vertex in interface Polygon2D
        Parameters:
        i - index of the vertex, between 0 and the number of vertices minus one
      • setVertex

        public void setVertex(int i,
                              Point2D point)
        Sets the position of the i-th vertex of this polygon.
        Specified by:
        setVertex in interface Polygon2D
        Parameters:
        i - index of the vertex, between 0 and the number of vertices
        point - the new position of the vertex
      • addVertex

        public void addVertex(Point2D position)
        Adds a vertex at the end of the last ring of this polygon.
        Specified by:
        addVertex in interface Polygon2D
        Parameters:
        position - the position of the new vertex
        Throws:
        java.lang.RuntimeException - if this MultiPolygon does not contain any ring
      • insertVertex

        public void insertVertex(int index,
                                 Point2D point)
        Inserts a vertex at the given position
        Specified by:
        insertVertex in interface Polygon2D
        Parameters:
        index - index at which the specified vertex is to be inserted
        point - the position of the new vertex
        Throws:
        java.lang.RuntimeException - if this polygon has no ring
        java.lang.IllegalArgumentException - if index is not smaller than vertex number
      • removeVertex

        public void removeVertex(int i)
        Returns the i-th vertex of the polygon.
        Specified by:
        removeVertex in interface Polygon2D
        Parameters:
        i - index of the vertex, between 0 and the number of vertices minus one
      • vertexNumber

        public int vertexNumber()
        Returns the total number of vertices in this polygon. The total number is computed as the sum of vertex number in each ring of the polygon.
        Specified by:
        vertexNumber in interface Polygon2D
      • closestVertexIndex

        public int closestVertexIndex(Point2D point)
        Computes the index of the closest vertex to the input point.
        Specified by:
        closestVertexIndex in interface Polygon2D
      • buffer

        public CirculinearDomain2D buffer(double dist)
        Description copied from interface: CirculinearShape2D
        Computes the buffer of the shape, formed by the set of points located at a distance from the shape that is lower or equal to d.
        Specified by:
        buffer in interface CirculinearShape2D
        Parameters:
        dist - the maximal distance between a point of the buffer and the shape
        Returns:
        the buffer of the shape
      • asPolygon

        public Polygon2D asPolygon(int n)
        Description copied from interface: Domain2D
        Returns an approximation of the domain as a polygon, or a MultiPolygon.
        Specified by:
        asPolygon in interface Domain2D
        Returns:
        a polygon
      • boundary

        public CirculinearContourArray2D<LinearRing2D> boundary()
        Description copied from interface: Domain2D
        Returns the boundary of the set. This boundary is either a continuous non intersecting curve (connected domain), or a set of non intersecting continuous curve (one continuous non-intersection for each connected part of the domain).

        The returned curve is oriented, with an interior and an exterior.

        Specified by:
        boundary in interface CirculinearDomain2D
        Specified by:
        boundary in interface Domain2D
        Specified by:
        boundary in interface Polygon2D
        Returns:
        the boundary of the domain
      • boundingBox

        public Box2D boundingBox()
        Description copied from interface: Shape2D
        Returns the bounding box of the shape.
        Specified by:
        boundingBox in interface Shape2D
        Returns:
        the bounding box of the shape.
      • clip

        public Polygon2D clip(Box2D box)
        Clips the polygon with the specified box.
        Specified by:
        clip in interface Domain2D
        Specified by:
        clip in interface Polygon2D
        Specified by:
        clip in interface Shape2D
        Parameters:
        box - the clipping box
        Returns:
        the clipped shape
      • distance

        public double distance(Point2D p)
        Description copied from interface: Shape2D
        Returns the distance of the shape to the given point, or the distance of point to the frontier of the shape in the case of a plain shape.
        Specified by:
        distance in interface Shape2D
      • distance

        public double distance(double x,
                               double y)
        Description copied from interface: Shape2D
        Returns the distance of the shape to the given point, specified by x and y, or the distance of point to the frontier of the shape in the case of a plain (i.e. fillable) shape.
        Specified by:
        distance in interface Shape2D
      • isBounded

        public boolean isBounded()
        Description copied from interface: Shape2D
        Returns true if the shape is bounded, that is if we can draw a finite rectangle enclosing the shape. For example, a straight line or a parabola are not bounded.
        Specified by:
        isBounded in interface Shape2D
      • isEmpty

        public boolean isEmpty()
        The MultiPolygon2D is empty either if it contains no ring, or if all rings are empty.
        Specified by:
        isEmpty in interface Shape2D
        Returns:
        true if the shape does not contain any point.
      • contains

        public boolean contains(Point2D point)
        Description copied from interface: Shape2D
        Checks if the shape contains the given point.
        Specified by:
        contains in interface Shape2D
      • contains

        public boolean contains(double x,
                                double y)
        Description copied from interface: Shape2D
        Checks if the shape contains the planar point defined by (x,y).
        Specified by:
        contains in interface Shape2D
      • draw

        public void draw(java.awt.Graphics2D g2)
        Description copied from interface: Domain2D
        Draws the boundary of the domain, using current Stroke and color.
        Specified by:
        draw in interface Domain2D
        Specified by:
        draw in interface Shape2D
        Parameters:
        g2 - the Graphics to draw on
      • fill

        public void fill(java.awt.Graphics2D g)
        Description copied from interface: Domain2D
        Fills the interior of the domain, using the Graphics current Paint.
        Specified by:
        fill in interface Domain2D
        Parameters:
        g - the Graphics to fill on
      • almostEquals

        public boolean almostEquals(GeometricObject2D obj,
                                    double eps)
        Description copied from interface: GeometricObject2D
        Checks if the two objects are similar up to a given threshold value. This method can be used to compare the results of geometric computations, that introduce errors due to numerical computations.
        Specified by:
        almostEquals in interface GeometricObject2D
        Parameters:
        obj - the object to compare
        eps - a threshold value, for example the minimal coordinate difference
        Returns:
        true if both object have the same value up to the threshold
      • equals

        public boolean equals(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • clone

        @Deprecated
        public MultiPolygon2D clone()
        Deprecated. use copy constructor instead (0.11.2)
        Overrides:
        clone in class java.lang.Object

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.