public class Point3D
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Constructor and Description |
---|
Point3D()
Creates a new Point3D with defaults of
X,Y,Z = 0.0 and W = 1.0.
|
Point3D(double[] values)
Creates a new Point3D whose values are taken from the specified array of doubles.
|
Point3D(double X,
double Y,
double Z)
Creates a new Point3D given three coordinates.
|
Point3D(double X,
double Y,
double Z,
double W)
Creates a new Point3D given three coordinates and a W value.
|
Point3D(float[] values)
Creates a new Point3D whose values are taken from the specified array of floats.
|
Point3D(Vector3D vec)
|
Modifier and Type | Method and Description |
---|---|
Point3D |
add(Point3D p2)
Returns a new Point3D whose X,Y,Z values
are the sum of this point's values and
the specified point's values.
|
java.lang.Object |
clone()
Returns a new Point3D which is a deep clone of this Point3D.
|
double |
distanceTo(Point3D p2)
Returns a real number that is the distance
between this point and the specified point.
|
Point3D |
div(double theDivisor)
Returns a new Point3D which is the
result of dividing this point by the
given divisor.
|
boolean |
equals(Point3D other)
|
double |
getW()
Returns the W component of this Point3D object.
|
double |
getX()
Returns the X component of this Point3D object.
|
double |
getY()
Returns the Y component of this Point3D object.
|
double |
getZ()
Returns the Z component of this Point3D object.
|
Point3D |
mid(Point3D p2)
Returns a new Point3D which is
the midpoint between this point and the
specified point.
|
Point3D |
minus(Point3D p2)
Returns a new Point3D whose X,Y,Z values are
the difference between this point's X,Y,Z
and the specified point's X,Y,Z.
|
Point3D |
mult(double theMultiplier)
Returns a new Point3D which is the
result of multiplying this point by the
given multiplier.
|
Point3D |
mult(Matrix3D mat)
Returns a new Point3D which is the result of
multiplying this point by the given matrix.
|
void |
scale(double scaleFactor)
Scales each of the X, Y, and Z components of this
point by the given scaleFactor.
|
void |
setW(double newW)
Sets the W component of this Point3D object.
|
void |
setX(double newX)
Sets the X component of this Point3D object.
|
void |
setY(double newY)
Sets the Y component of this Point3D object.
|
void |
setZ(double newZ)
Sets the Z component of this Point3D object.
|
java.lang.String |
toString()
Returns a printable representation of this Point3D.
|
public Point3D()
public Point3D(double X, double Y, double Z)
public Point3D(double X, double Y, double Z, double W)
public Point3D(float[] values)
public Point3D(double[] values)
public Point3D(Vector3D vec)
Vector3D
; that is, considers
the specified Vector3D
as a vector from the origin to the point specified by the
head of the vector, and constructs a Point3D containing the same X,Y,Z values as the
Vector3D
. The W component of the new Point3D is set to 1, regardless of the value
in the W component of the vector (which is normally 0).vec
- public double getX()
public double getY()
public double getZ()
public double getW()
public void setX(double newX)
public void setY(double newY)
public void setZ(double newZ)
public void setW(double newW)
public java.lang.Object clone()
clone
in class java.lang.Object
public Point3D minus(Point3D p2)
public double distanceTo(Point3D p2)
public Point3D add(Point3D p2)
public Point3D mid(Point3D p2)
public Point3D mult(double theMultiplier)
public Point3D div(double theDivisor)
public Point3D mult(Matrix3D mat)
public void scale(double scaleFactor)
public boolean equals(Point3D other)
public java.lang.String toString()
toString
in class java.lang.Object