|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectSim.Location
public class Location
Location represents a Node's location in the World.
| Constructor Summary | |
|---|---|
Location(double x,
double y)
Construct a new location object, given the x,y coordinates. |
|
| Method Summary | |
|---|---|
Location |
add(Location other)
Adds two location objects to one another. |
double |
getAngle(Location l1,
Location l2)
Find the angle of the triangle at this objects point using law of cosines. |
double |
getDistance(Location other)
Get the distance between two points. |
double |
getQuadrance(Location other)
Returns the square of the distance between two locations, or quadrance. |
int |
getSize()
Returns the size of this Location as it is seralized on the network. |
double |
getX()
|
double |
getY()
|
Location |
mult(double scalar)
Multiply the location by a scalar and return the new location object. |
Location |
sub(Location other)
subtracts two location objects to one another. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Location(double x,
double y)
x - y - | Method Detail |
|---|
public double getX()
public double getY()
public double getQuadrance(Location other)
other - non-null other Location
public double getDistance(Location other)
other - another location object to get the distance
between
public Location mult(double scalar)
scalar - number to multiple the x,y values by
public double getAngle(Location l1,
Location l2)
l1 - l2 -
public Location add(Location other)
other - Object to add
public Location sub(Location other)
other - Object to add
public int getSize()
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||