jist.swans.misc
Class Location.Location3D

java.lang.Object
  extended by jist.swans.misc.Location
      extended by jist.swans.misc.Location.Location3D
All Implemented Interfaces:
java.lang.Cloneable, JistAPI.Timeless
Enclosing class:
Location

public static final class Location.Location3D
extends Location

A three-dimensional location implementation.

Since:
SWANS1.0
Author:
Rimon Barr <barr+jist@cs.cornell.edu>

Nested Class Summary
 
Nested classes/interfaces inherited from class jist.swans.misc.Location
Location.Location2D, Location.Location3D
 
Field Summary
private  float x
          co-ordinates.
private  float y
          co-ordinates.
private  float z
          co-ordinates.
 
Constructor Summary
Location.Location3D(float x, float y, float z)
          Create three-dimensional coordinate.
 
Method Summary
 void add(Location l)
          Vector addition of locations...
 float distance(Location l)
          Compute distance between two locations.
 float distanceSqr(Location l)
          Compute distance squared between two locations.
 float getHeight()
          Return height of location.
 float getX()
          Return X-coordinate of location.
 float getY()
          Return Y-coordinate of location.
 boolean inside(Location bounds)
          Determine whether point is inside bounds.
 boolean inside(Location min, Location max)
          Determine whether points is inside bounds.
 Location step(Location l, int steps)
          Divide (scale) vector from current to second location into a number of equal step (displacement) vectors.
 java.lang.String toString()
          
 
Methods inherited from class jist.swans.misc.Location
getClone, parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

private float x
co-ordinates.


y

private float y
co-ordinates.


z

private float z
co-ordinates.

Constructor Detail

Location.Location3D

public Location.Location3D(float x,
                           float y,
                           float z)
Create three-dimensional coordinate.

Parameters:
x - x-coordinate
y - y-coordinate
z - z-coordinate
Method Detail

distanceSqr

public float distanceSqr(Location l)
Compute distance squared between two locations.

Specified by:
distanceSqr in class Location
Parameters:
l - second location
Returns:
distance squared between current and second location

distance

public float distance(Location l)
Compute distance between two locations.

Specified by:
distance in class Location
Parameters:
l - second location
Returns:
distance between current and second location

step

public Location step(Location l,
                     int steps)
Divide (scale) vector from current to second location into a number of equal step (displacement) vectors.

Specified by:
step in class Location
Parameters:
l - destination location
steps - number of steps to destination
Returns:
step displacement vector

getX

public float getX()
Return X-coordinate of location.

Specified by:
getX in class Location
Returns:
x-coordinate of location

getY

public float getY()
Return Y-coordinate of location.

Specified by:
getY in class Location
Returns:
y-coordinate of location

getHeight

public float getHeight()
Return height of location.

Specified by:
getHeight in class Location
Returns:
height of location

inside

public boolean inside(Location bounds)
Determine whether point is inside bounds.

Specified by:
inside in class Location
Parameters:
bounds - bounds to test again
Returns:
whether point within bounds

inside

public boolean inside(Location min,
                      Location max)
Determine whether points is inside bounds.

Specified by:
inside in class Location
Parameters:
min - lower left bound
max - upper right bound
Returns:
whether point within bounds

add

public void add(Location l)
Vector addition of locations... Be careful! This method mutates the current object.

Specified by:
add in class Location
Parameters:
l - second location / displacement

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object