|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.starhope.appius.geometry.Tuple3D<Coord3D>
org.starhope.appius.geometry.Coord3D
public class Coord3D
A coördinate triplet (x,y,z)
Field Summary | |
---|---|
static Coord3D |
ORIGIN
origin point (0,0,0) |
private static long |
serialVersionUID
Java serialisation unique ID |
Fields inherited from class org.starhope.appius.geometry.Tuple3D |
---|
x, y, z |
Constructor Summary | |
---|---|
Coord3D()
Create a coordinate set at (0,0,0) |
|
Coord3D(Coord3D proto)
Copy constructor |
|
Coord3D(double x0,
double y0,
double z0)
Creates a coordinate triplet |
|
Coord3D(org.json.JSONObject jso)
Creates a coordinate triplet from a JSONObject |
|
Coord3D(Point2D p)
|
Method Summary | |
---|---|
int |
compareTo(Object other)
Since there's no reasonable ordering for 3D points in a linear fashion, I compare their string forms. |
Coord3D |
constrain(Coord3D minBounds,
Coord3D maxBounds)
Constrain this object's coordinates to be within the given boundaries. |
double |
distance(Coord3D other)
Find the distance to another point, from this one. |
static double |
distance(Coord3D a,
Coord3D b)
Subtract two three-dimensional coordinates, returning the absolute distance between them. |
boolean |
equals(Object obj)
This is an overriding method. |
static Coord3D |
fromString(String string)
|
double |
inverseSquare(Coord3D other)
Syntactic sugar: This just returns the square root of the distance between two points, as a syntactic sugar for sound- and air-related events. |
static double |
inverseSquare(Coord3D a,
Coord3D b)
Syntactic sugar: This just returns the square root of the distance between two points, as a syntactic sugar for sound- and air-related events. |
protected Coord3D |
newInstance(double x0,
double y0,
double z0)
Method used to create a new object of the child's type while getting around down-casting problems in Java |
static Coord3D |
randomIn(Room aRoom)
Generate a random 3D coördinate someplace within the volume described by a given room. |
Coord2D |
toCoord2D()
Converts the 3D coordinate to a 2D coordinate. |
Methods inherited from class org.starhope.appius.geometry.Tuple3D |
---|
add, add, clone, divide, getX, getY, getZ, hashCode, multiply, subtract, subtract, toJSON, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
public static final Coord3D ORIGIN
Constructor Detail |
---|
public Coord3D()
public Coord3D(Coord3D proto)
proto
- prototype to be copiedpublic Coord3D(double x0, double y0, double z0)
x0
- x ordinatey0
- y abscissaz0
- z ordinatepublic Coord3D(org.json.JSONObject jso) throws org.json.JSONException
jso
- JSON object containing "x", "y", and "z" coördinates
org.json.JSONException
- if the object is malformedpublic Coord3D(Point2D p)
p
- pointMethod Detail |
---|
public static double distance(Coord3D a, Coord3D b)
a
- One point;b
- and the other
public static Coord3D fromString(String string)
string
- A coordinate string as one of: JSON { x:###, y:###,
z:### } or (x,y,z) or [x:y:z]
public static double inverseSquare(Coord3D a, Coord3D b)
a
- One pointb
- The other
public static Coord3D randomIn(Room aRoom)
aRoom
- some room
public int compareTo(Object other)
other
- the other point
public Coord3D constrain(Coord3D minBounds, Coord3D maxBounds)
minBounds
- The least they can be;maxBounds
- The most;
public double distance(Coord3D other)
other
- Some other point
public boolean equals(Object obj)
equals
in class Tuple3D<Coord3D>
Object.equals(java.lang.Object)
public double inverseSquare(Coord3D other)
other
- The other point
protected Coord3D newInstance(double x0, double y0, double z0)
Tuple3D
newInstance
in class Tuple3D<Coord3D>
x0
- x ordinatey0
- y abscissaz0
- z ordinate
Tuple3D.newInstance(double,
double, double)
public Coord2D toCoord2D()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |