public class

Location

extends Vector3D
implements Cloneable HasLocation
java.lang.Object
   ↳ org.apache.commons.math.geometry.Vector3D
     ↳ uk.ac.imperial.presage2.util.location.Location
Known Direct Subclasses

Class Overview

This represents a location in the environment space as defined by a 3D vector. We the apache commons Vector3D class for this vector.

Summary

[Expand]
Inherited Constants
From class org.apache.commons.math.geometry.Vector3D
Public Constructors
Location(double x, double y)
Create a 2D location with the given x and y coordinates.
Location(double x, double y, double z)
Create a 3D location with the given x, y and z coordinates.
Location(Vector3D v)
Create a location from an existing Vector3D.
Public Methods
double distanceTo(Location l)
Get the distance between this Location and the location l
Location getLocation()
Move getMoveTo(Location l)
Get the Move from this Location which will result in the location l.
Move getMoveTo(Location l, double speed)
Get the Move from this Location towards a location l with a magnitude less than or equal to speed.
Vector3D getVector()
Vector3D getVectorTo(Location l)
Get the direction vector between two point vectors.
boolean in(Area a)
Returns the result of contains(Location) for a and this.
void setLocation(Location l)
Not available in Immutable Location class.
Protected Methods
Location clone()
[Expand]
Inherited Methods
From class org.apache.commons.math.geometry.Vector3D
From class java.lang.Object
From interface uk.ac.imperial.presage2.util.location.HasLocation

Public Constructors

public Location (double x, double y)

Create a 2D location with the given x and y coordinates.

public Location (double x, double y, double z)

Create a 3D location with the given x, y and z coordinates.

public Location (Vector3D v)

Create a location from an existing Vector3D.

Public Methods

public double distanceTo (Location l)

Get the distance between this Location and the location l

public Location getLocation ()

public Move getMoveTo (Location l)

Get the Move from this Location which will result in the location l.

Returns
  • Move m such that this.add(m) will return a vector v.equals(l)

public Move getMoveTo (Location l, double speed)

Get the Move from this Location towards a location l with a magnitude less than or equal to speed.

public Vector3D getVector ()

public Vector3D getVectorTo (Location l)

Get the direction vector between two point vectors.

Returns

public boolean in (Area a)

Returns the result of contains(Location) for a and this. Allows more intuitive syntax when checking that a Location is in an Area.

public void setLocation (Location l)

Not available in Immutable Location class.

Protected Methods

protected Location clone ()

Since: API Level