Class Polygon2D_F64

java.lang.Object
georegression.struct.shapes.Polygon2D_F64
All Implemented Interfaces:
Serializable

public class Polygon2D_F64 extends Object implements Serializable
Describes a polygon in 2D.
See Also:
  • Field Details

  • Constructor Details

    • Polygon2D_F64

      public Polygon2D_F64(double[][] a)
    • Polygon2D_F64

      public Polygon2D_F64(Polygon2D_F64 a)
    • Polygon2D_F64

      public Polygon2D_F64(int numVertexes)
    • Polygon2D_F64

      public Polygon2D_F64(double... xy)
    • Polygon2D_F64

      public Polygon2D_F64()
  • Method Details

    • zero

      public void zero()
      Sets the value of every vertex to be zero
    • setTo

      public Polygon2D_F64 setTo(Polygon2D_F64 orig)
    • set

      public void set(int index, double x, double y)
    • getSideLength

      public double getSideLength(int index)
      Resturns the length of the specified side that is composed of point index and index+1
      Returns:
      Euclidean length of the side
    • get

      public Point2D_F64 get(int index)
    • size

      public int size()
    • copy

      public Polygon2D_F64 copy()
    • areaSimple

      public double areaSimple()
      Returns the area for simply polygons. Non-self intersecting convex or concave.
      Returns:
      area
    • isInside

      public boolean isInside(Point2D_F64 p)
      Returns true if the point is inside the polygon. Points along the border are ambiguously considered inside or outside.
      Parameters:
      p - A point
      Returns:
      true if inside and false if outside
      See Also:
    • isCCW

      public boolean isCCW()
      true if the order of vertexes is in counter-clockwise order.
      Returns:
      true if ccw or false if cw
    • isConvex

      public boolean isConvex()
    • isIdentical

      public boolean isIdentical(Polygon2D_F64 a, double tol)
    • isEquivalent

      public boolean isEquivalent(Polygon2D_F64 a, double tol)
    • flip

      public void flip()
    • flip

      public Polygon2D_F64 flip(@Nullable @Nullable Polygon2D_F64 storage)
      Creates a copy of 'this' and flips it
    • getLine

      public LineSegment2D_F64 getLine(int index, LineSegment2D_F64 storage)
      Returns the line/edge defined by vertex index and index+1.
      Parameters:
      index - Index of the line
      Returns:
      A new instance of the line segment.
    • convert

      public List<Point2D_F64> convert(@Nullable @Nullable List<Point2D_F64> storage, boolean copy)
      Converts the polygon into a list.
      Parameters:
      storage - (Optional) storage to put the vertexes into
      copy - If points will be copied otherwise a reference of points will be returned
      Returns:
      List of vertexes
    • setTo

      public void setTo(List<Point2D_F64> list)
      Sets the polygon to be the same as the list. A true copy is created and no references to points in the list are saved.
      Parameters:
      list - List which the polygon will be set to
    • toString

      public String toString()
      Overrides:
      toString in class Object