Class Geometry

java.lang.Object
me.autobot.lib.math.objects.Geometry

public class Geometry extends Object
A class containing geometry utility functions.
  • Constructor Details

    • Geometry

      public Geometry()
      Geometry class is a utility class and should not be instantiated.
  • Method Details

    • twoPolygonsIntersecting

      public static boolean twoPolygonsIntersecting(Vector2d[] polygonA, Vector2d[] polygonB)
      Checks if two polygons are intersecting
      Parameters:
      polygonA - The first polygon The polygon is represented as an array of Vector2d points The points are in counter-clockwise order The last point is connected to the first point The polygon is assumed to be convex The polygon is assumed to be simple (no self-intersections)
      polygonB - The second polygon The polygon is represented as an array of Vector2d points Same assumptions as polygonA
      Returns:
      true if the polygons are intersecting, false otherwise
    • isSeparatingAxisTheorem

      public static boolean isSeparatingAxisTheorem(Vector2d[] a, Vector2d[] b)
      Checks if two polygons are intersecting using the Separating Axis Theorem
      Parameters:
      a - The first polygon
      b - The second polygon
      Returns:
      true if the polygons are intersecting, false otherwise
    • projectPolygon

      public static Projection projectPolygon(Vector2d[] polygon, Vector2d axis)
      Projects a polygon onto an axis and returns the projection range
      Parameters:
      polygon - The polygon to project The polygon is represented as an array of Vector2d points
      axis - The axis to project the polygon onto The axis is represented as a Vector2d
      Returns:
      The projection range