public final class Double3D
extends java.lang.Object
implements java.io.Serializable
One day in the far future, Double3D should also be HIGHLY efficient; since it is immutable, it can be passed by value rather than by pointer by a smart compiler. Not today, though. But it's not bad.
This class has an elaborate hash code generation that is much more random than Sun's standard generator, but takes more time. For very large numbers of objects, this is a good idea, but we may change it to a simpler version in the future.
Double3D.equals(...) can compare by value against other Int3Ds and Double3Ds.
Constructor and Description |
---|
Double3D() |
Double3D(Double2D p)
Explicitly assumes the z value is set to 0
|
Double3D(Double2D p,
double z) |
Double3D(Double3D p) |
Double3D(double x,
double y,
double z) |
Double3D(Int2D p)
Explicitly assumes the z value is set to 0
|
Double3D(Int2D p,
double z) |
Double3D(Int3D p) |
Double3D(MutableDouble2D p)
Explicitly assumes the z value is set to 0
|
Double3D(MutableDouble2D p,
double z) |
Double3D(MutableDouble3D p) |
Double3D(MutableInt2D p)
Explicitly assumes the z value is set to 0
|
Double3D(MutableInt2D p,
double z) |
Double3D(MutableInt3D p) |
Modifier and Type | Method and Description |
---|---|
Double3D |
add(Double3D other)
Adds Double3D "other" to current Double3D using
vector addition
|
double |
distance(Double3D p)
Returns the distance FROM this Double3D TO the specified point.
|
double |
distance(double x,
double y,
double z)
Returns the distance FROM this Double3D TO the specified point
|
double |
distance(Int3D p)
Returns the distance FROM this Double3D TO the specified point.
|
double |
distance(MutableInt3D p)
Returns the distance FROM this Double3D TO the specified point.
|
double |
distanceSq(Double3D p)
Returns the squared distance FROM this Double3D TO the specified point.
|
double |
distanceSq(double x,
double y,
double z)
Returns the squared distance FROM this Double3D TO the specified point
|
double |
distanceSq(Int3D p)
Returns the squared distance FROM this Double3D TO the specified point.
|
double |
distanceSq(MutableInt3D p)
Returns the squared distance FROM this Double3D TO the specified point.
|
double |
dot(Double3D other)
Takes the dot product this Double3D with another
|
boolean |
equals(java.lang.Object obj) |
double |
getX() |
double |
getY() |
double |
getZ() |
int |
hashCode() |
double |
length()
Returns the vector length of the Double3D
|
double |
lengthSq()
Returns the vector length of the Double3D
|
double |
manhattanDistance(Double3D p)
Returns the manhtattan distance FROM this Double3D TO the specified point
|
double |
manhattanDistance(double x,
double y,
double z)
Returns the manhtattan distance FROM this Double3D TO the specified point
|
double |
manhattanDistance(Int3D p)
Returns the manhtattan distance FROM this Double3D TO the specified point
|
double |
manhattanDistance(MutableDouble3D p)
Returns the manhtattan distance FROM this Double3D TO the specified point
|
double |
manhattanDistance(MutableInt3D p)
Returns the manhtattan distance FROM this Double3D TO the specified point
|
Double3D |
multiply(double val)
Multiplies each element by scalar "val"
|
Double3D |
negate()
Returns the negation of this Double3D.
|
Double3D |
normalize()
Normalizes the vector (sets its length to 1).
|
Double3D |
resize(double dist)
Scales the vector to length "dist".
|
Double3D |
subtract(Double3D other)
Subtracts Double3D "other" from current Double3D using
vector subtraction
|
java.lang.String |
toCoordinates() |
java.lang.String |
toString() |
public Double3D()
public Double3D(Int2D p)
public Double3D(Int2D p, double z)
public Double3D(Int3D p)
public Double3D(MutableInt2D p)
public Double3D(MutableInt2D p, double z)
public Double3D(MutableInt3D p)
public Double3D(Double2D p)
public Double3D(Double2D p, double z)
public Double3D(Double3D p)
public Double3D(MutableDouble2D p)
public Double3D(MutableDouble2D p, double z)
public Double3D(MutableDouble3D p)
public Double3D(double x, double y, double z)
public final double getX()
public final double getY()
public final double getZ()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toCoordinates()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public double distance(double x, double y, double z)
public double distance(Double3D p)
public double distance(Int3D p)
public double distance(MutableInt3D p)
public double distanceSq(double x, double y, double z)
public double distanceSq(Double3D p)
public double distanceSq(Int3D p)
public double distanceSq(MutableInt3D p)
public double manhattanDistance(double x, double y, double z)
public double manhattanDistance(Double3D p)
public double manhattanDistance(Int3D p)
public double manhattanDistance(MutableDouble3D p)
public double manhattanDistance(MutableInt3D p)
public final Double3D add(Double3D other)
public final Double3D subtract(Double3D other)
public final double length()
public final double lengthSq()
public final Double3D multiply(double val)
public final Double3D resize(double dist)
public final Double3D normalize()
public final double dot(Double3D other)
public final Double3D negate()