georegression.geometry
Class UtilPolygons2D_F64
- java.lang.Object
-
- georegression.geometry.UtilPolygons2D_F64
-
public class UtilPolygons2D_F64 extends java.lang.ObjectVarious functions related to polygons.
-
-
Constructor Summary
Constructors Constructor and Description UtilPolygons2D_F64()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static voidbounding(Quadrilateral_F64 quad, Rectangle2D_F64 rectangle)Finds the minimum area bounding rectangle around the quadrilateral.static Point2D_F64center(Quadrilateral_F64 quad, Point2D_F64 center)Computes the center or average point in the quadrilateral.static voidconvert(Polygon2D_F64 input, Quadrilateral_F64 output)Converts a polygon into a quadrilateralstatic voidconvert(Quadrilateral_F64 input, Polygon2D_F64 output)Converts a quadrilateral into a polygonstatic voidconvert(Rectangle2D_F64 input, Polygon2D_F64 output)Converts a rectangle into a polygonstatic voidconvert(Rectangle2D_F64 input, Quadrilateral_F64 output)Converts a rectangle into a quadrilateralstatic voidconvert(RectangleLength2D_I32 input, Quadrilateral_F64 output)Converts a rectangle into a quadrilateralstatic voidconvexHull(java.util.List<Point2D_F64> points, Polygon2D_F64 hull)Computes the convex hull of the set of points.static voidflip(Polygon2D_F64 a)Flips the order of points inside the polygon.static booleanisCCW(java.util.List<Point2D_F64> polygon)Returns true if the polygon is ordered in a counter-clockwise order.static booleanisCCW(Polygon2D_F64 polygon)static booleanisConvex(Polygon2D_F64 poly)Determines if the polugon is convex or concave.static booleanisEquivalent(Polygon2D_F64 a, Polygon2D_F64 b, double tol)Checks to see if the vertexes of the two polygon's are the same up to the specified tolerance and allows for a shift in their orderstatic booleanisIdentical(Polygon2D_F64 a, Polygon2D_F64 b, double tol)Checks to see if the vertexes of the two polygon's are the same up to the specified tolerancestatic voidshiftDown(Polygon2D_F64 a)Shifts all the vertexes in the polygon up one element.static voidshiftUp(Polygon2D_F64 a)Shifts all the vertexes in the polygon up one element.static voidvertexAverage(Polygon2D_F64 input, Point2D_F64 average)Computes the average of all the vertexes
-
-
-
Method Detail
-
isConvex
public static boolean isConvex(Polygon2D_F64 poly)
Determines if the polugon is convex or concave.- Parameters:
poly- Polygon- Returns:
- true if convex and false if concave
-
convert
public static void convert(Rectangle2D_F64 input, Quadrilateral_F64 output)
Converts a rectangle into a quadrilateral- Parameters:
input- Rectangle.output- Quadrilateral. Modified.
-
convert
public static void convert(Rectangle2D_F64 input, Polygon2D_F64 output)
Converts a rectangle into a polygon- Parameters:
input- Rectangle.output- Polygon2D_F64. Modified.
-
convert
public static void convert(Quadrilateral_F64 input, Polygon2D_F64 output)
Converts a quadrilateral into a polygon- Parameters:
input- Quadrilateral.output- Polygon2D_F64. Modified.
-
convert
public static void convert(Polygon2D_F64 input, Quadrilateral_F64 output)
Converts a polygon into a quadrilateral- Parameters:
input- polygon.output- Quadrilateral. Modified.
-
convert
public static void convert(RectangleLength2D_I32 input, Quadrilateral_F64 output)
Converts a rectangle into a quadrilateral- Parameters:
input- Rectangle.output- Quadrilateral. Modified.
-
bounding
public static void bounding(Quadrilateral_F64 quad, Rectangle2D_F64 rectangle)
Finds the minimum area bounding rectangle around the quadrilateral.- Parameters:
quad- (Input) Quadrilateralrectangle- (Output) Minimum area rectangle
-
center
public static Point2D_F64 center(Quadrilateral_F64 quad, Point2D_F64 center)
Computes the center or average point in the quadrilateral.- Parameters:
quad- (Input) Quadrilateralcenter- (output) Center point of the quadrilateral. Can be null.- Returns:
- The center point.
-
isCCW
public static boolean isCCW(java.util.List<Point2D_F64> polygon)
Returns true if the polygon is ordered in a counter-clockwise order. This is done by summing up the interior angles.- Parameters:
polygon- List of ordered points which define a polygon- Returns:
- true if CCW and false if CW
-
isCCW
public static boolean isCCW(Polygon2D_F64 polygon)
-
vertexAverage
public static void vertexAverage(Polygon2D_F64 input, Point2D_F64 average)
Computes the average of all the vertexes- Parameters:
input- (input) polygonaverage- (output) average point
-
isIdentical
public static boolean isIdentical(Polygon2D_F64 a, Polygon2D_F64 b, double tol)
Checks to see if the vertexes of the two polygon's are the same up to the specified tolerance- Parameters:
a- Polygonb- Polygontol- tolerance- Returns:
- true if identical up to tolerance or false if not
-
isEquivalent
public static boolean isEquivalent(Polygon2D_F64 a, Polygon2D_F64 b, double tol)
Checks to see if the vertexes of the two polygon's are the same up to the specified tolerance and allows for a shift in their order- Parameters:
a- Polygonb- Polygontol- tolerance- Returns:
- true if identical up to tolerance or false if not
-
flip
public static void flip(Polygon2D_F64 a)
Flips the order of points inside the polygon. The first index will remain the same will otherwise be reversed- Parameters:
a- Polygon of order 3 or more.
-
shiftUp
public static void shiftUp(Polygon2D_F64 a)
Shifts all the vertexes in the polygon up one element. Wraps around at the end- Parameters:
a- Polygon
-
shiftDown
public static void shiftDown(Polygon2D_F64 a)
Shifts all the vertexes in the polygon up one element. Wraps around at the end- Parameters:
a- Polygon
-
convexHull
public static void convexHull(java.util.List<Point2D_F64> points, Polygon2D_F64 hull)
Computes the convex hull of the set of points.NOTE: This method declares a temporary array. If you want to avoid that invoke
AndrewMonotoneConvexHull_F64directly.- Parameters:
points- (Input) Set of points.hull- (output) storage for convex hull. Will be in counter-clockwise order
-
-
DataMelt 3.0 © DataMelt by jWork.ORG