public class Point
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
double |
x
x coordinate
|
double |
y
y coordinate
|
double |
z
z coordinate
|
static Point |
ZERO
A point that is always 0,0,0
|
Constructor and Description |
---|
Point()
Creates a new instance of Vector
|
Point(double _x,
double _y,
double _z)
Creates a new instance of Vector
|
Point(Point v)
Creates a new instance of Vector
|
Modifier and Type | Method and Description |
---|---|
void |
add(double _x,
double _y,
double _z)
Add a triplet (x/y/z) to us
|
void |
add(Point v)
Add another vector to ours.
|
Point |
angle(Point other) |
Point |
append(Point ov)
return the results of us+them (doens't modify us)
|
protected java.lang.Object |
clone()
clone this vector.
|
boolean |
equals(Point p)
Return whether two points are equal
|
boolean |
isZero()
Return whether this point is zero
|
void |
multiply(double d)
Multiply our vector by a double
|
void |
negate()
multiply by -1
|
void |
normalize()
normalize the vector
|
Point |
reduce(Point ov)
return the results of us-them (doens't modify us)
|
void |
rotateDegrees(Point vec)
rotate this vector around the origin by the vector passed.
|
void |
rotateRadians(Point vec) |
void |
set(double d)
Set each of this Point's components to the value passed
|
void |
set(double _x,
double _y,
double _z)
Set this point to be the value of the x/y/z passed in
|
void |
set(Point v)
Set this point to be the same as the point passed in
|
void |
setVlength(double len)
Set the length of this vector.
|
void |
setZero()
Set our point to be 0,0,0
|
void |
subtract(double _x,
double _y,
double _z)
Subtract a triplet (x/y/z) to us
|
void |
subtract(Point v)
Subtract another vector from ours.
|
java.lang.String |
toDebugDegreesString() |
java.lang.String |
toDebugString()
Return a string of a POV-Ray vector.
|
java.lang.String |
toDegreesString()
return this vector as a POV-Ray vector string expressed in degrees
|
java.lang.String |
toString()
return a POV-Ray compatible string of this vector.
|
double |
vlength()
return the length of the 3-D vector
|
public static final Point ZERO
public double x
public double y
public double z
public Point()
public Point(double _x, double _y, double _z)
_x
- The x coordinate of the new Vector_y
- The y coordinate of the new Vector_z
- The z coordinate of the new Vectorpublic Point(Point v)
v
- The vector to initialize our coordinates fromprotected java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- Whateverpublic boolean equals(Point p)
public boolean isZero()
public void setZero()
public void set(Point v)
public void set(double _x, double _y, double _z)
public void set(double d)
public Point append(Point ov)
ov
- The other vector to addpublic void add(Point v)
v
- The other vector.public void add(double _x, double _y, double _z)
public void subtract(Point v)
v
- The other vector.public void subtract(double _x, double _y, double _z)
public Point reduce(Point ov)
ov
- The other vector to subtractpublic void multiply(double d)
d
- The amount to multiply each of our x,y,z coordinates by.public void negate()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toDebugString()
public java.lang.String toDebugDegreesString()
public java.lang.String toDegreesString()
public double vlength()
public void setVlength(double len)
len
- The length to set this vector to.public void normalize()
public void rotateDegrees(Point vec)
vec
- The vector, expressed in degrees of the rotation. i.e. 0,180,90public void rotateRadians(Point vec)