Package georegression.struct.shapes
Class Polygon2D_F32
java.lang.Object
georegression.struct.shapes.Polygon2D_F32
- All Implemented Interfaces:
Serializable,MapFormattable
@Generated("georegression.struct.shapes.Polygon2D_F64")
public class Polygon2D_F32
extends Object
implements Serializable, MapFormattable
Describes a polygon in 2D.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPolygon2D_F32(float... xy) Polygon2D_F32(float[][] a) Polygon2D_F32(int numVertexes) -
Method Summary
Modifier and TypeMethodDescriptionfloatReturns the area for simply polygons.convert(@Nullable List<Point2D_F32> storage, boolean copy) Converts the polygon into a list.copy()voidflip()flip(@Nullable Polygon2D_F32 storage) Creates a copy of 'this' and flips itformat(MatrixPrintFormat fmt) formatMap(MapPrintFormat fmt) get(int index) getLine(int index, LineSegment2D_F32 storage) Returns the line/edge defined by vertex index and index+1.floatgetSideLength(int index) Resturns the length of the specified side that is composed of point index and index+1booleanisCCW()true if the order of vertexes is in counter-clockwise order.booleanisConvex()booleanisEquivalent(Polygon2D_F32 a, float tol) booleanisIdentical(Polygon2D_F32 a, float tol) booleanReturns true if the point is inside the polygon.voidset(int index, float x, float y) setTo(Polygon2D_F32 orig) voidsetTo(List<Point2D_F32> list) Sets the polygon to be the same as the list.intsize()toString()voidzero()Sets the value of every vertex to be zeroMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.ejml.MapFormattable
formatMap
-
Field Details
-
vertexes
-
-
Constructor Details
-
Polygon2D_F32
public Polygon2D_F32(float[][] a) -
Polygon2D_F32
-
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
-
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
-
size
public int size() -
copy
-
areaSimple
public float areaSimple()Returns the area for simply polygons. Non-self intersecting convex or concave.- Returns:
- area
-
isInside
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
-
isEquivalent
-
flip
public void flip() -
flip
Creates a copy of 'this' and flips it -
getLine
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
Converts the polygon into a list.- Parameters:
storage- (Optional) storage to put the vertexes intocopy- If points will be copied otherwise a reference of points will be returned- Returns:
- List of vertexes
-
setTo
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
-
format
-
formatMap
- Specified by:
formatMapin interfaceMapFormattable
-
toString
-