Class GPoint

All Implemented Interfaces:
EventEmitterInterface, EventListener, CanCopy, DecomposeWhenDrawn<Point>, HasParents<GObject>, SceneObject, HasProperties

public class GPoint extends GObject implements HasParents<GObject>, DecomposeWhenDrawn<Point>
GPoint is a class that represents a single point in 3D space.

Unlike other GObjects who's pivot has to be calculated to be it's geometric centre, a GPoint's pivot is just its position.

a Thing stores GPoints separately as they form the core of any transformation irrespective of whether it's part of some other geometry. This means all transformations need to be point based and applied to the GPoint.

A GPoint is also stored within SceneManager.points for redundancy.

See Also:
  • Field Details

    • DIAMETER

      public static final int DIAMETER
      The diameter of the point when drawn on screen.

      This should be used as the standard diameter for all points.

      See Also:
    • parents

      private final HashSet<GObject> parents
    • renderState

      private RenderState<Point,GObject> renderState
  • Constructor Details

    • GPoint

      public GPoint(Vector3 v3)
      Default Constructor
      Parameters:
      v3 - The position of this point.
  • Method Details

    • fromRaw

      public static GPoint fromRaw(String id, Vector3 point)
      Constructs a GPoint.
      Parameters:
      id - The ID of the GPoint defined by the file
      point - The position of the GPoint defined by the file
      Returns:
      A GPoint
    • setPivot

      public void setPivot(Vector3 pivot)
      Description copied from class: GObject
      Sets the pivot point.
      Overrides:
      setPivot in class GObject
      Parameters:
      pivot - The new pivot point.
    • toPoint

      public Point toPoint()
    • addProps

      private void addProps()
    • deleteSelf

      public boolean deleteSelf()
      Description copied from class: GObject
      Deletes itself
      Overrides:
      deleteSelf in class GObject
      Returns:
      true if the object was deleted
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class GObject
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getParents

      public HashSet<GObject> getParents()
      Description copied from interface: HasParents
      Retrieves the set of all parent objects that this object belongs to.
      Specified by:
      getParents in interface HasParents<GObject>
      Returns:
      A HashSet containing all parent objects. Using a Set ensures that a parent can only be added once.
    • addParent

      public void addParent(GObject parent)
      Description copied from interface: HasParents
      Adds a parent to this object's set of parents.
      Specified by:
      addParent in interface HasParents<GObject>
      Parameters:
      parent - The parent object to add.
    • removeParent

      public void removeParent(GObject parent)
      Description copied from interface: HasParents
      Removes a parent from this object's set of parents.
      Specified by:
      removeParent in interface HasParents<GObject>
      Parameters:
      parent - The parent object to remove.
    • copy

      public void copy(CopyProperties props) throws InvalidCopyException
      Description copied from interface: CanCopy
      Copies the properties of this object based on the provided CopyProperties. The implementation should handle how the copying is performed, potentially creating a new instance or modifying an existing one.
      Specified by:
      copy in interface CanCopy
      Overrides:
      copy in class GObject
      Parameters:
      props - The properties defining how the copy operation should be performed.
      Throws:
      InvalidCopyException - If the copy operation cannot be completed due to invalid properties or state.
    • copySelf

      protected GPoint copySelf()
    • explode

      public void explode(GObject line)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class GObject
    • decompose

      public void decompose()
      Specified by:
      decompose in interface DecomposeWhenDrawn<Point>
    • getDecomposeList

      public ArrayList<RenderState<Point,GObject>> getDecomposeList()
      Specified by:
      getDecomposeList in interface DecomposeWhenDrawn<Point>
    • genericRenderStateList

      public ArrayList genericRenderStateList()
      Overrides:
      genericRenderStateList in class GObject
    • getEngineObjectType

      public EngineObject.Type getEngineObjectType()
      Specified by:
      getEngineObjectType in class GObject