Class Circle


public class Circle extends PrimitiveShape
The shape implementation of a circle.
Since:
19.06.2021
Author:
Juyas
  • Constructor Details

    • Circle

      public Circle(org.joml.Vector2f relativeCenter, float radius)
  • Method Details

    • adjust

      public void adjust()
      Description copied from class: PrimitiveShape
      Will be called by PrimitiveShape.setPosition(Vector2f) after the new position was set. Used to recalculate the absolute coordinates.
      Overrides:
      adjust in class PrimitiveShape
    • supportPoint

      public org.joml.Vector2f supportPoint(org.joml.Vector2f v)
      Description copied from class: PrimitiveShape
      According to GJKSM this method is supposed to calculate the point of the shape, that is most in direction of v. The general rule is, the more primitive the shape is, the more efficient this method can be. This method may be described as max{v*x,x element of Shape} for any complex shape.
      Overrides:
      supportPoint in class PrimitiveShape
      Parameters:
      v - the direction
      Returns:
      the point of the shape that is most in the direction of v
    • intersection

      public boolean intersection(Circle circle)
      Check intersection between two circles efficiently without using square roots. Will only produce wrong results originated in missing precision in floating point numbers.
      Parameters:
      circle - the circle to compare to
      Returns:
      true if the given circle intersects with this one
    • rayCast

      public RayCastResult rayCast(org.joml.Vector2f start, org.joml.Vector2f rayDirection, float maxLength)
      Calculate a raycast against this circle using absolute coordinates.
      Parameters:
      start - the starting point of the raycast
      rayDirection - the direction of the ray, it doesnt have to be normalized, it will be by the method
      maxLength - the max length of ray, if it can't hit within this range, it doesnt hit
      Returns:
      the result of the raycast