Class Location

java.lang.Object
com.sparshui.common.Location
All Implemented Interfaces:
Serializable

public class Location extends Object implements Serializable
Represents a 2D location with float values.
Author:
Jay Roltgen
See Also:
  • Constructor Details

    • Location

      public Location()
      Cosntruct a default location. Values are initialized as the coordinates (0, 0).
    • Location

      public Location(float x, float y)
      Construct a specific location.
      Parameters:
      x - The x coordinate value of the location.
      y - The y coordinate value of the location.
  • Method Details

    • getX

      public float getX()
      Returns:
      The x coordinate value.
    • getY

      public float getY()
      Returns:
      The y coordinate value.
    • toString

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

      public float getDistance(Location location)
    • getVector

      public V3 getVector(Location location)
    • getCenter

      public static Location getCenter(Location a, Location b)
    • getCentroid

      public static Location getCentroid(Location a, Location b, float w)
      get weighted average location. w = 0 --> all a; w = 1 --> all b
      Parameters:
      a -
      b -
      w -
      Returns:
      Location
    • pixelLocation

      public static Location pixelLocation(Location location)
    • screenLocation

      public static Location screenLocation(Location location)