Class EllipticalOrbit

Object
EllipticalOrbit
All Implemented Interfaces:
OrbitAPI

public class EllipticalOrbit extends Object implements OrbitAPI
Represents an elliptical orbit path.
Since:
1.9
Author:
LazyWizard
  • Field Details

    • focus

      protected final SectorEntityToken focus
    • orbitAngle

      protected final float orbitAngle
    • orbitWidth

      protected final float orbitWidth
    • orbitHeight

      protected final float orbitHeight
    • orbitSpeed

      protected final float orbitSpeed
    • offsetSin

      protected final float offsetSin
    • offsetCos

      protected final float offsetCos
    • entity

      protected SectorEntityToken entity
    • currentAngle

      protected float currentAngle
  • Constructor Details

    • EllipticalOrbit

      public EllipticalOrbit(SectorEntityToken focus, float startAngle, float orbitWidth, float orbitHeight, float orbitAngle, float daysPerOrbit)
      Creates an elliptical orbit around a focus object.
      Parameters:
      focus - What to orbit around.
      startAngle - The angle (in degrees) that the orbit will begin at. 0 degrees = right - this is not relative to orbitAngle.
      orbitWidth - The width of the ellipse that makes up the orbital path.
      orbitHeight - The height of the ellipse that makes up the orbital path.
      orbitAngle - The angular offset of the ellipse that makes up the orbital path.
      daysPerOrbit - How long it should take for us to make one orbit around focus.
      Since:
      1.9
  • Method Details

    • getAngle

      public float getAngle()
      Returns the current angle along the orbital path of the orbiting entity.
      Returns:
      The angle of the current position along the elliptical path.
      Since:
      1.9
    • getOrbitWidth

      public float getOrbitWidth()
      Returns the width of the ellipsis used as a path.
      Returns:
      The width of the ellipsis in su.
      Since:
      1.9
    • getOrbitHeight

      public float getOrbitHeight()
      Returns the height of the ellipsis used as a path.
      Returns:
      The height of the ellipsis in su.
      Since:
      1.9
    • getOrbitAngle

      public float getOrbitAngle()
      Returns the offset angle of the ellipsis used as a path.
      Returns:
      The offset of the ellipsis used as a path, in degrees.
      Since:
      1.9
    • setAngle

      public void setAngle(float angle)
      Explicitly sets where along our orbital path we should be.
      Parameters:
      angle - The angle (in degrees) along the orbital path we should be moved to.
      Since:
      1.9
    • getFocus

      public SectorEntityToken getFocus()
      Returns the object we are orbiting.
      Specified by:
      getFocus in interface OrbitAPI
      Returns:
      The SectorEntityToken we are orbiting around.
    • setEntity

      public void setEntity(SectorEntityToken entity)
      Called by Starsector itself - you can ignore this.
      Specified by:
      setEntity in interface OrbitAPI
    • advance

      public void advance(float amount)
      Called by Starsector itself - you can ignore this.
      Specified by:
      advance in interface OrbitAPI
    • makeCopy

      public OrbitAPI makeCopy()
      Specified by:
      makeCopy in interface OrbitAPI
    • computeCurrentLocation

      public Vector2f computeCurrentLocation()
      Specified by:
      computeCurrentLocation in interface OrbitAPI
    • getOrbitalPeriod

      public float getOrbitalPeriod()
      Specified by:
      getOrbitalPeriod in interface OrbitAPI
    • updateLocation

      public void updateLocation()
      Specified by:
      updateLocation in interface OrbitAPI