Class UtilPolygons2D_I32

java.lang.Object
georegression.geometry.UtilPolygons2D_I32

public class UtilPolygons2D_I32 extends Object
Various functions related to polygons.
  • Constructor Details

    • UtilPolygons2D_I32

      public UtilPolygons2D_I32()
  • Method Details

    • bounding

      public static void bounding(List<Point2D_I32> points, Rectangle2D_I32 rectangle)
      Finds the minimum area bounding rectangle which is aligned to the x and y axis around the list of points. Note (x0,y0) is inclusive and (x1,y1) is exclusive.
      Parameters:
      points - (Input) Quadrilateral
      rectangle - (Output) Minimum area rectangle
    • bounding

      public static void bounding(Polygon2D_I32 quad, Rectangle2D_I32 rectangle)
      Finds the minimum area bounding rectangle which is aligned to the x and y axis around the polygon. Note (x0,y0) is inclusive and (x1,y1) is exclusive.
      Parameters:
      quad - (Input) Quadrilateral
      rectangle - (Output) Minimum area rectangle
    • isCCW

      public static boolean isCCW(List<Point2D_I32> 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
    • flip

      public static void flip(Polygon2D_I32 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.
    • isConvex

      public static boolean isConvex(Polygon2D_I32 poly)
      Determines if the polugon is convex or concave.
      Parameters:
      poly - Polygon
      Returns:
      true if convex and false if concave
    • isPositiveZ

      public static boolean isPositiveZ(Point2D_I32 a, Point2D_I32 b, Point2D_I32 c)
      Returns true if the cross product would result in a strictly positive z (e.g. z > 0 ). If true then the order is clockwise. v0 = a-b v1 = c-b
      Parameters:
      a - first point in sequence
      b - second point in sequence
      c - third point in sequence
      Returns:
      true if positive z
    • isIdentical

      public static boolean isIdentical(Polygon2D_I32 a, Polygon2D_I32 b)
      Checks to see if the vertexes of the two polygon's are the same up to the specified tolerance
      Parameters:
      a - Polygon
      b - Polygon
      Returns:
      true if identical up to tolerance or false if not
    • isEquivalent

      public static boolean isEquivalent(Polygon2D_I32 a, Polygon2D_I32 b)
      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 - Polygon
      b - Polygon
      Returns:
      true if identical up to tolerance or false if not