Package com.sparshui.common
Class Location
java.lang.Object
com.sparshui.common.Location
- All Implemented Interfaces:
Serializable
Represents a 2D location with float values.
- Author:
- Jay Roltgen
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Location
static Location
getCentroid
(Location a, Location b, float w) get weighted average location.float
getDistance
(Location location) float
getX()
float
getY()
static Location
pixelLocation
(Location location) static Location
screenLocation
(Location location) toString()
-
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
-
getDistance
-
getVector
-
getCenter
-
getCentroid
get weighted average location. w = 0 --> all a; w = 1 --> all b- Parameters:
a
-b
-w
-- Returns:
- Location
-
pixelLocation
-
screenLocation
-