java.lang.Object
dev.prozilla.pine.core.rendering.shape.Shape
dev.prozilla.pine.core.rendering.shape.Circle
All Implemented Interfaces:
Cloneable<Shape>, ColoredDrawable, Drawable, TexturedDrawable

public class Circle extends Shape
Generates a circular shape.
  • Field Details

    • position

      protected Vector2f position
    • radius

      protected float radius
    • edges

      protected int edges
  • Constructor Details

    • Circle

      public Circle(Vector2f position, float radius)
    • Circle

      public Circle(Vector2f position, float radius, int edges)
  • Method Details

    • generateVertices

      protected float[] generateVertices()
      Description copied from class: Shape
      Generates the vertex array for this shape.

      Odd elements define the x-component of the vertex and even elements define the y-component.

      Every three vertices (or six elements) define a triangle.

      Specified by:
      generateVertices in class Shape
      Returns:
      The array of vertices.
    • generateUVs

      protected float[] generateUVs()
      Description copied from class: Shape
      Generates the UV array for this shape.

      Odd elements define the x-component of the texture coordinate and even elements define the y-component.

      Specified by:
      generateUVs in class Shape
      Returns:
      The array of texture coordinates.
    • getX

      public float getX()
      Returns the x-coordinate of this circle.
      Returns:
      The x-coordinate of this circle.
    • getY

      public float getY()
      Returns the y-coordinate of this circle.
      Returns:
      The y-coordinate of this circle.
    • setX

      public void setX(float x)
      Sets the x-coordinate of this circle.
      Parameters:
      x - The new x-coordinate
    • setY

      public void setY(float y)
      Sets the y-coordinate of this circle.
      Parameters:
      y - The new y-coordinate
    • setPosition

      public void setPosition(Vector2f position)
      Sets the position of this circle.
      Parameters:
      position - The new position
    • getRadius

      public float getRadius()
      Returns the radius of this circle.
      Returns:
      The radius of this circle.
    • setRadius

      public void setRadius(float radius)
      Sets the radius of this circle.
      Parameters:
      radius - The new radius of this circle
    • getEdges

      public int getEdges()
      Returns the amount of edges of this circle.
      Returns:
      The amount of edges.
    • setAutoEdges

      public void setAutoEdges()
      Automatically sets the amount of edges based on the radius.
    • setEdges

      public void setEdges(int edges)
      Sets the amount of edges of this circle.
      Parameters:
      edges - The new amount of edges
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • equals

      public boolean equals(Shape shape)
      Description copied from interface: Cloneable
      Checks if the given object is equal to this object.
      Parameters:
      shape - Other object
      Returns:
      true if both objects are equal.
    • equals

      public boolean equals(Circle circle)
    • clone

      public Shape clone()
      Description copied from interface: Cloneable
      Returns a new object that is equal to this object.
      Specified by:
      clone in interface Cloneable<Shape>
      Specified by:
      clone in class Shape
      Returns:
      Clone of this object