public class Point3D extends Object
Modifier and Type | Field and Description |
---|---|
static Point3D |
ZERO
Point or vector with all three coordinates set to 0.
|
Constructor and Description |
---|
Point3D(double x,
double y,
double z)
Creates a new instance of
Point3D . |
Modifier and Type | Method and Description |
---|---|
Point3D |
add(double x,
double y,
double z)
Returns a point with the specified coordinates added to the coordinates
of this point.
|
Point3D |
add(Point3D point)
Returns a point with the coordinates of the specified point added to the
coordinates of this point.
|
double |
angle(double x,
double y,
double z)
Computes the angle (in degrees) between the vector represented
by this point and the specified vector.
|
double |
angle(Point3D point)
Computes the angle (in degrees) between the vector represented
by this point and the vector represented by the specified point.
|
double |
angle(Point3D p1,
Point3D p2)
Computes the angle (in degrees) between the three points with this point
as a vertex.
|
Point3D |
crossProduct(double x,
double y,
double z)
Computes cross product of the vector represented by this instance
and the specified vector.
|
Point3D |
crossProduct(Point3D vector)
Computes cross product of the vector represented by this instance
and the specified vector.
|
double |
distance(double x1,
double y1,
double z1)
Computes the distance between this point and point
(x1, y1, z1) . |
double |
distance(Point3D point)
Computes the distance between this point and the specified
point . |
double |
dotProduct(double x,
double y,
double z)
Computes dot (scalar) product of the vector represented by this instance
and the specified vector.
|
double |
dotProduct(Point3D vector)
Computes dot (scalar) product of the vector represented by this instance
and the specified vector.
|
boolean |
equals(Object obj)
Returns a hash code value for the point.
|
double |
getX()
The x coordinate.
|
double |
getY()
The y coordinate.
|
double |
getZ()
The z coordinate.
|
int |
hashCode()
Returns a hash code for this
Point3D object. |
double |
magnitude()
Computes magnitude (length) of the relative magnitude vector represented
by this instance.
|
Point3D |
midpoint(double x,
double y,
double z)
Returns a point which lies in the middle between this point and the
specified coordinates.
|
Point3D |
midpoint(Point3D point)
Returns a point which lies in the middle between this point and the
specified point.
|
Point3D |
multiply(double factor)
Returns a point with the coordinates of this point multiplied
by the specified factor
|
Point3D |
normalize()
Normalizes the relative magnitude vector represented by this instance.
|
Point3D |
subtract(double x,
double y,
double z)
Returns a point with the specified coordinates subtracted from
the coordinates of this point.
|
Point3D |
subtract(Point3D point)
Returns a point with the coordinates of the specified point subtracted
from the coordinates of this point.
|
String |
toString()
Returns a string representation of this
Point3D . |
public static final Point3D ZERO
public Point3D(double x, double y, double z)
Point3D
.x
- The X coordinate of the Point3D
y
- The Y coordinate of the Point3D
z
- The Z coordinate of the Point3D
public final double getX()
public final double getY()
public final double getZ()
public double distance(double x1, double y1, double z1)
(x1, y1, z1)
.x1
- the x coordinate of other pointy1
- the y coordinate of other pointz1
- the z coordinate of other point(x1, y1, z1)
.public double distance(Point3D point)
point
.point
- the other pointpoint
.NullPointerException
- if the specified point
is nullpublic Point3D add(double x, double y, double z)
x
- the X coordinate additiony
- the Y coordinate additionz
- the Z coordinate additionpublic Point3D add(Point3D point)
point
- the point whose coordinates are to be addedNullPointerException
- if the specified point
is nullpublic Point3D subtract(double x, double y, double z)
x
- the X coordinate subtractiony
- the Y coordinate subtractionz
- the Z coordinate subtractionpublic Point3D subtract(Point3D point)
point
- the point whose coordinates are to be subtractedNullPointerException
- if the specified point
is nullpublic Point3D multiply(double factor)
factor
- the factor multiplying the coordinatespublic Point3D normalize()
Point3D
instancepublic Point3D midpoint(double x, double y, double z)
x
- the X coordinate of the second endpointy
- the Y coordinate of the second endpointz
- the Z coordinate of the second endpointpublic Point3D midpoint(Point3D point)
point
- the other endpointNullPointerException
- if the specified point
is nullpublic double angle(double x, double y, double z)
x
- the X magnitude of the other vectory
- the Y magnitude of the other vectorz
- the Z magnitude of the other vectorpublic double angle(Point3D point)
point
- the other vectorNaN
if any of the two vectors is a zero vectorNullPointerException
- if the specified point
is nullpublic double angle(Point3D p1, Point3D p2)
p1
- one pointp2
- other pointNaN
if the three points are not different
from one anotherNullPointerException
- if the p1
or p2
is nullpublic double magnitude()
public double dotProduct(double x, double y, double z)
x
- the X magnitude of the other vectory
- the Y magnitude of the other vectorz
- the Z magnitude of the other vectorpublic double dotProduct(Point3D vector)
vector
- the other vectorNullPointerException
- if the specified vector
is nullpublic Point3D crossProduct(double x, double y, double z)
x
- the X magnitude of the other vectory
- the Y magnitude of the other vectorz
- the Z magnitude of the other vectorpublic Point3D crossProduct(Point3D vector)
vector
- the other vectorNullPointerException
- if the specified vector
is nullpublic boolean equals(Object obj)
public int hashCode()
Point3D
object.public String toString()
Point3D
.
This method is intended to be used only for informational purposes.
The content and format of the returned string might vary between
implementations.
The returned string might be empty but cannot be null
.Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.