Package georegression.struct.shapes
Class Polygon2D_F64
java.lang.Object
georegression.struct.shapes.Polygon2D_F64
- All Implemented Interfaces:
Serializable
Describes a polygon in 2D.
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPolygon2D_F64
(double... xy) Polygon2D_F64
(double[][] a) Polygon2D_F64
(int numVertexes) -
Method Summary
Modifier and TypeMethodDescriptiondouble
Returns the area for simply polygons.convert
(@Nullable List<Point2D_F64> storage, boolean copy) Converts the polygon into a list.copy()
void
flip()
flip
(@Nullable Polygon2D_F64 storage) Creates a copy of 'this' and flips itget
(int index) getLine
(int index, LineSegment2D_F64 storage) Returns the line/edge defined by vertex index and index+1.double
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_F64 a, double tol) boolean
isIdentical
(Polygon2D_F64 a, double tol) boolean
Returns true if the point is inside the polygon.void
set
(int index, double x, double y) setTo
(Polygon2D_F64 orig) void
setTo
(List<Point2D_F64> 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_F64
public Polygon2D_F64(double[][] a) -
Polygon2D_F64
-
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
-
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
-
size
public int size() -
copy
-
areaSimple
public double 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
-