Class Polygon2D_F32

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

@Generated("georegression.struct.shapes.Polygon2D_F64") public class Polygon2D_F32 extends Object implements Serializable
Describes a polygon in 2D.
See Also:
  • Field Details

  • Constructor Details

    • Polygon2D_F32

      public Polygon2D_F32(float[][] a)
    • Polygon2D_F32

      public Polygon2D_F32(Polygon2D_F32 a)
    • Polygon2D_F32

      public Polygon2D_F32(int numVertexes)
    • Polygon2D_F32

      public Polygon2D_F32(float... xy)
    • Polygon2D_F32

      public Polygon2D_F32()
  • Method Details

    • zero

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

      public Polygon2D_F32 setTo(Polygon2D_F32 orig)
    • set

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

      public float 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_F32 get(int index)
    • size

      public int size()
    • copy

      public Polygon2D_F32 copy()
    • areaSimple

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

      public boolean isInside(Point2D_F32 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_F32 a, float tol)
    • isEquivalent

      public boolean isEquivalent(Polygon2D_F32 a, float tol)
    • flip

      public void flip()
    • flip

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

      public LineSegment2D_F32 getLine(int index, LineSegment2D_F32 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_F32> convert(@Nullable @Nullable List<Point2D_F32> 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_F32> 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