Package georegression.struct.shapes
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 Summary
-
Constructor Summary
ConstructorDescriptionPolygon2D_F32
(float... xy) Polygon2D_F32
(float[][] a) Polygon2D_F32
(int numVertexes) -
Method Summary
Modifier and TypeMethodDescriptionfloat
Returns the area for simply polygons.convert
(@Nullable List<Point2D_F32> storage, boolean copy) Converts the polygon into a list.copy()
void
flip()
flip
(@Nullable Polygon2D_F32 storage) Creates a copy of 'this' and flips itget
(int index) getLine
(int index, LineSegment2D_F32 storage) Returns the line/edge defined by vertex index and index+1.float
getSideLength
(int index) Resturns the length of the specified side that is composed of point index and index+1boolean
isCCW()
true if the order of vertexes is in counter-clockwise order.boolean
isConvex()
boolean
isEquivalent
(Polygon2D_F32 a, float tol) boolean
isIdentical
(Polygon2D_F32 a, float tol) boolean
Returns true if the point is inside the polygon.void
set
(int index, float x, float y) setTo
(Polygon2D_F32 orig) void
setTo
(List<Point2D_F32> list) Sets the polygon to be the same as the list.int
size()
toString()
void
zero()
Sets the value of every vertex to be zero
-
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
-
toString
-