Class Shapes

java.lang.Object
physics.collision.Shapes

public class Shapes extends Object
Util methods to create PrimitiveShape on the fly.
Since:
20.06.2021
Author:
Juyas
  • Constructor Details

    • Shapes

      public Shapes()
  • Method Details

    • circle

      public static Circle circle(org.joml.Vector2f center, org.joml.Vector2f circlePosition, float radius)
      Create a circle.
      Parameters:
      center - the absolute center of the circle
      circlePosition - the current absolute position of the circle's center
      radius - the radius of the circle
      Returns:
      a circle
    • circle

      public static Circle circle(org.joml.Vector2f center, float radius)
      Create a circle.
      Parameters:
      center - the relative center of the circle
      radius - the radius of the circle
      Returns:
      a circle
    • circle

      public static Circle circle(float x, float y, float r)
      Create a circle.
      Parameters:
      x - the relative x coord of the circles center
      y - the relative y coord of the circles center
      r - the radius of the circle
      Returns:
      a circle
    • convexPolygon

      public static ConvexPolygon convexPolygon(float... coordPairs)
      Create a convex polygon by a given set of coordinate pairs.
      Parameters:
      coordPairs - a dynamic array of coordinates, which must have an even size.
      Returns:
      a ConvexPolygon over all given points or null if the coordinates have a odd size
    • triangle

      public static Triangle triangle(float ax, float ay, float bx, float by, float cx, float cy)
      Create a triangle.
      Parameters:
      ax - relative coordinate Ax
      ay - relative coordinate Ay
      bx - relative coordinate Bx
      by - relative coordinate By
      cx - relative coordinate Cx
      cy - relative coordinate Cy
      Returns:
      a triangle
    • triangle

      public static Triangle triangle(org.joml.Vector2f a, org.joml.Vector2f b, org.joml.Vector2f c)
      Create a triangle.
      Parameters:
      a - relative point a
      b - relative point b
      c - relative point c
      Returns:
      a triangle
    • axisAlignedRectangle

      public static Quadrilateral axisAlignedRectangle(float ax, float ay, float bx, float by)
      Create an axis aligned rectangle. This will find min corner and max corner and generate both missing points through basic geometry
      Parameters:
      ax - relative coordinate Ax
      ay - relative coordinate Ay
      bx - relative coordinate Bx
      by - relative coordinate By
      Returns:
      an axis aligned rectangle
    • quadrilateral

      public static Quadrilateral quadrilateral(org.joml.Vector2f a, org.joml.Vector2f b, org.joml.Vector2f c, org.joml.Vector2f d)
      Create a quadrilateral.
      Parameters:
      a - relative point a
      b - relative point b
      c - relative point c
      d - relative point d
      Returns:
      a quadrilateral
    • axisAlignedRectangle

      public static Quadrilateral axisAlignedRectangle(org.joml.Vector2f a, org.joml.Vector2f b)
      Create an axis aligned rectangle. This will find min corner and max corner and generate both missing points through basic geometry
      Parameters:
      a - relative point a
      b - relative point b
      Returns:
      an axis aligned rectangle