public class Point3DFloat
extends java.lang.Object
When discussing spherical coordinate systems, this uses the physics conventions (ISO 80000-2:2019) discussed in the Wikipedia article for Spherical Coordinate System.
A spherical coordinate is represented as (r, theta, phi) where r is the
distance to the origin, theta is the angle down from the z axis (in
radians), and phi is the angle starting from the x axis and rotating
toward the y axis (in radians.) When these are mapped to a Point3DDouble
,
x is r, y is theta, and z is phi.
An altitude-azimuth (altAz) coordinate is represented as (r, alt, az)
where r is the distance to the origin, alt is the angle "up" from the
horizon, and az is the azimuth angle in radians with 0 being north (y
axis) and increasing toward the east (x axis). When these are mapped to a
Point3DDouble
, x is r, y is alt, and z is az.
A cylindrical coordinate is similar to altitude-azimuth and represented as
(r, az, h) where r is the distance in the x-y plane to the z axis, az is
the azimuth angle in radians with 0 being north (y axis) and increasing
toward the east (x axis), and h is the height (equal to the z axis.)
When these are mapped to a Point3DDouble
, x is r, y is az, and z is h.
Modifier and Type | Field and Description |
---|---|
float |
x
The x coordinate.
|
float |
y
The y coordinate.
|
float |
z
The z coordinate.
|
Constructor and Description |
---|
Point3DFloat(float x,
float y,
float z)
Construct a Point3DFloat with the specified coordinates.
|
Point3DFloat(Point3DInt orig)
Construct a Point3DFloat from a Point3DInt
|
Modifier and Type | Method and Description |
---|---|
Point3DFloat |
add(Point3DFloat p2)
Constructs a new Point3DFloat where the components of p2 are added to
this point.
|
static Point3DFloat |
add(Point3DFloat p1,
Point3DFloat p2)
Constructs a new Point3DFloat where the components are added to
each other.
|
void |
addInPlace(float x2,
float y2,
float z2)
Adds the specified coordinates to this point, modifying it in
place.
|
void |
addInPlace(Point3DFloat p2)
Adds the specified Point3DFloat to this point, modifying it in
place.
|
float |
addLength(Point3DFloat p2)
Returns the length of this+p2.
|
static Point3DFloat |
altAzToXYZ(double r,
double alt,
double az,
double cx,
double cy,
double cz,
Point3DFloat out)
Transforms altAz coordinates r, alt, az into cartesian coordinates
x, y, z.
|
static Point3DFloat |
altAzToXYZ(Point3DDouble altAz,
Point3DFloat out)
Transforms this point which represents its elements as altAz
coordinates r, alt, az, into cartesian coordinates x, y, z.
|
Point3DFloat |
crossProduct(Point3DFloat b)
Calculates the cross product of this vector and another vector, each
represented as a Point3DFloat, in 3D space and returns the vector cross
product.
|
static Point3DFloat |
crossProduct(Point3DFloat V,
Point3DFloat W)
Calculates the cross product of two vectors in 3D space, each
represented as a Point3DFloat, and returns the vector cross product.
|
static Point3DFloat |
crossProduct(Point3DFloat p1,
Point3DFloat p2,
Point3DFloat p3)
Returns the cross prduct of three points in 3D space (as listed in
counterclockwise order as seen from the "outside") and returns the vector
cross product.
|
static float |
crossProductLength(float vx,
float vy,
float vz,
float wx,
float wy,
float wz)
Calculates the LENGTH of the cross product of two vectors in 3D space
and returns the length.
|
float |
crossProductLength(Point3DFloat v)
Calculates the LENGTH of the cross product of two vectors in 3D space
and returns the length.
|
static float |
crossProductLength(Point3DFloat V,
Point3DFloat W)
Calculates the LENGTH of the cross product of this vector and another
vector in 3D space and returns the length.
|
static Point3DFloat |
cylindricalToXYZ(double r,
double az,
double h,
double cx,
double cy,
double cz,
Point3DFloat out)
Transforms cylindrical coordinates r, az, h into cartesian coordinates
x, y, z.
|
static Point3DFloat |
cylindricalToXYZ(Point3DDouble cyl,
Point3DFloat out)
Transforms this point which represents its elements as cylindrical
coordinates r, az, h into cartesian coordinates x, y, z.
|
float |
distance(float x2,
float y2,
float z2)
Calculates the distance between this point and some 3-D coordinates.
|
static float |
distance(float x1,
float y1,
float z1,
float x2,
float y2,
float z2)
Returns the distance between two points specified by their
coordinates.
|
float |
distance(Point3DFloat p2)
Calculates the distance between this point and another point.
|
static float |
distance(Point3DFloat p1,
Point3DFloat p2)
Calculates the distance between two points.
|
float |
distanceSquared(Point3DFloat p2)
Returns the squared distance between this point and another point.
|
static float |
distanceSquared(Point3DFloat p1,
Point3DFloat p2)
Returns the squared distance between two points.
|
Point3DFloat |
divide(float scale)
Constructs a new Point3DFloat where the components of p2 are divided
by a scalar.
|
void |
divideInPlace(float scale)
Divides the specified Point3DFloat by a scalar, modifying it in
place.
|
float |
divideLength(float scale)
Returns the length of this / scale.
|
float |
dotProduct(Point3DFloat v2)
Returns the dot product of this vector and another vector, each
represented as a Point3DFloat.
|
static float |
dotProduct(Point3DFloat v1,
Point3DFloat v2)
Returns the dot product of two vectors, each represented as a
Point3DFloat.
|
float |
length()
Treats this point as a vector and returns its length from the origin.
|
static float |
length(float x1,
float y1,
float z1)
Treat the coordinates as a vector and return its length from the
origin.
|
float |
lengthSquared()
Treats this point as a vector and returns its length squared from the
origin.
|
static float |
lengthSquared(float x1,
float y1,
float z1)
Treat the coordinates as a vector and return its length squared from the
origin.
|
static Point3DFloat |
makeNormal(float x,
float y,
float z)
Constructs a Point3DFloat that is normalized to have length 1.
|
Point3DFloat |
multiply(float scale)
Constructs a new Point3DFloat where the components of p2 are multiplied
by a scalar.
|
void |
multiplyInPlace(float scale)
Multiplies the specified Point3DFloat by a scalar, modifying it in
place.
|
float |
multiplyLength(float scale)
Returns the length of this * scale.
|
Point3DFloat |
normalize()
Treats this point as a vector and normalizes it to have length 1,
returning a new vector that is the normalized vector.
|
void |
normalizeInPlace()
Normalizes a Point3DFloat in place, making it have length 1.
|
static double |
signum(double a)
Java didn't have java.lang.math.Signum until Java 1.5.
|
static Point3DFloat |
sphericalToXYZ(double r,
double theta,
double phi,
double cx,
double cy,
double cz,
Point3DFloat out)
Transforms spherical coordinates r, theta, phi into cartesian coordinates
x, y, z.
|
static Point3DFloat |
sphericalToXYZ(Point3DDouble spher,
Point3DFloat out)
Transforms this point which represents its elements as spherical
coordinates r, theta, phi into cartesian coordinates x, y, z.
|
Point3DFloat |
subtract(Point3DFloat p2)
Constructs a new Point3DFloat where the components of p2 are subtracted
from this point.
|
static Point3DFloat |
subtract(Point3DFloat p1,
Point3DFloat p2)
Constructs a new Point3DFloat where the components are subtracted from
each other.
|
void |
subtractInPlace(float x2,
float y2,
float z2)
Subtracts the specified coordinates from this point, modifying it in
place.
|
void |
subtractInPlace(Point3DFloat p2)
Subtracts the specified Point3DFloat from this point, modifying it in
place.
|
Point3DDouble |
toAltAz()
Converts this point represented as an X,Y,Z coordinate to a
Point3DDouble indicating the coordinates in (r, alt, az).
|
static Point3DDouble |
toAltAz(double x,
double y,
double z)
Converts an X,Y,Z coordinate to a Point3DDouble indicating the
coordinates in (r, alt, az).
|
static Point3DDouble |
toAltAz(double x,
double y,
double z,
double cx,
double cy,
double cz,
Point3DDouble out)
Converts an X,Y,Z coordinate to a Point3DDouble indicating the
coordinates in (r, alt, az).
|
Point3DDouble |
toAltAz(Point3DDouble out)
Converts this point represented as an X,Y,Z coordinate to a
Point3DDouble indicating the coordinates in (r, alt, az).
|
Point3DDouble |
toCylindrical()
Converts this point represented as an X,Y,Z coordinate to a
Point3DDouble indicating the coordinates in (r, az, h).
|
static Point3DDouble |
toCylindrical(double x,
double y,
double z)
Converts an X,Y,Z coordinate to a Point3DDouble indicating the
coordinates in (r, az, h).
|
static Point3DDouble |
toCylindrical(double x,
double y,
double z,
double cx,
double cy,
double cz,
Point3DDouble out)
Converts an X,Y,Z coordinate to a Point3DDouble indicating the
coordinates in (r, az, h).
|
Point3DDouble |
toCylindrical(Point3DDouble out)
Converts this point represented as an X,Y,Z coordinate to a
Point3DDouble indicating the coordinates in (r, az, h).
|
Point3DDouble |
toSpherical()
Converts this point represented as an X,Y,Z coordinate to a
Point3DDouble indicating the coordinates in (r, theta, phi).
|
static Point3DDouble |
toSpherical(double x,
double y,
double z)
Converts an X,Y,Z coordinate to a Point3DDouble indicating the
coordinates in (r, theta, phi).
|
static Point3DDouble |
toSpherical(double x,
double y,
double z,
double cx,
double cy,
double cz,
Point3DDouble out)
Converts an X,Y,Z coordinate to a Point3DDouble indicating the
coordinates in (r, theta, phi).
|
Point3DDouble |
toSpherical(Point3DDouble out)
Converts this point represented as an X,Y,Z coordinate to a
Point3DDouble indicating the coordinates in (r, theta, phi).
|
java.lang.String |
toString()
Returns a String representation of this point.
|
public float x
public float y
public float z
public Point3DFloat(float x, float y, float z)
public Point3DFloat(Point3DInt orig)
public static Point3DFloat makeNormal(float x, float y, float z)
public float length()
public static float length(float x1, float y1, float z1)
public float lengthSquared()
public static float lengthSquared(float x1, float y1, float z1)
public Point3DFloat normalize()
public void normalizeInPlace()
public Point3DFloat subtract(Point3DFloat p2)
public static Point3DFloat subtract(Point3DFloat p1, Point3DFloat p2)
public void subtractInPlace(Point3DFloat p2)
public void subtractInPlace(float x2, float y2, float z2)
public Point3DFloat add(Point3DFloat p2)
public static Point3DFloat add(Point3DFloat p1, Point3DFloat p2)
public void addInPlace(Point3DFloat p2)
public void addInPlace(float x2, float y2, float z2)
public float addLength(Point3DFloat p2)
public Point3DFloat multiply(float scale)
public void multiplyInPlace(float scale)
public float multiplyLength(float scale)
public Point3DFloat divide(float scale)
public void divideInPlace(float scale)
public float divideLength(float scale)
public static float distance(Point3DFloat p1, Point3DFloat p2)
public float distance(Point3DFloat p2)
public float distance(float x2, float y2, float z2)
public static float distanceSquared(Point3DFloat p1, Point3DFloat p2)
public float distanceSquared(Point3DFloat p2)
public static float distance(float x1, float y1, float z1, float x2, float y2, float z2)
public static Point3DFloat crossProduct(Point3DFloat V, Point3DFloat W)
public Point3DFloat crossProduct(Point3DFloat b)
public static Point3DFloat crossProduct(Point3DFloat p1, Point3DFloat p2, Point3DFloat p3)
public float crossProductLength(Point3DFloat v)
public static float crossProductLength(Point3DFloat V, Point3DFloat W)
public static float crossProductLength(float vx, float vy, float vz, float wx, float wy, float wz)
public static float dotProduct(Point3DFloat v1, Point3DFloat v2)
public float dotProduct(Point3DFloat v2)
public static Point3DFloat sphericalToXYZ(double r, double theta, double phi, double cx, double cy, double cz, Point3DFloat out)
r
- The radial distancetheta
- The angle "down" from the z axisphi
- The angle starting from the x axis and rotating toward the y
axis.out
- An optional (may be null) Point3DFloat that receives the
results to avoid allocations. If this is null, a new object will be
allocated. If out is an object, it will be modified in place with the
results and also returned.public static Point3DFloat sphericalToXYZ(Point3DDouble spher, Point3DFloat out)
spher
- A Point3DDouble
which contains its coordinates as (r,
theta, phi)out
- An optional (may be null) Point3DFloat that receives the
results to avoid allocations. If out is null, a new object will be
allocated. If out is an object, it will be modified in place with the
results and also returned.public Point3DDouble toSpherical()
toSpherical(Point3DDouble)
method.public Point3DDouble toSpherical(Point3DDouble out)
out
- An optional (may be null) Point3DDouble that receives the
results to avoid allocations. If out is null, a new object will be
allocated. If out is an object, it will be modified in place with the
results and also returned.public static Point3DDouble toSpherical(double x, double y, double z)
toSpherical(double,double,double,double,double,double,Point3DDouble)
method.public static Point3DDouble toSpherical(double x, double y, double z, double cx, double cy, double cz, Point3DDouble out)
out
- An optional (may be null) Point3DDouble that receives the
results to avoid allocations. If out is null, a new object will be
allocated. If out is an object, it will be modified in place with the
results and also returned.public static Point3DFloat altAzToXYZ(double r, double alt, double az, double cx, double cy, double cz, Point3DFloat out)
r
- The radial distancealt
- The altitude angle "up" from the horizon in radians.az
- The azimuth angle east of north in radians.out
- An optional (may be null) Point3DFloat that receives the
results to avoid allocations. If this is null, a new object will be
allocated. If out is an object, it will be modified in place with the
results and also returned.public static Point3DFloat altAzToXYZ(Point3DDouble altAz, Point3DFloat out)
altAz
- A Point3DDouble which contains its coordinates as (r, alt,
az)out
- An optional (may be null) Point3DFloat that receives the
results to avoid allocations. If out is null, a new object will be
allocated. If out is an object, it will be modified in place with the
results and also returned.public Point3DDouble toAltAz()
toAltAz(Point3DDouble)
method.public Point3DDouble toAltAz(Point3DDouble out)
out
- An optional (may be null) Point3DDouble that receives the
results to avoid allocations. If out is null, a new object will be
allocated. If out is an object, it will be modified in place with the
results and also returned.public static Point3DDouble toAltAz(double x, double y, double z)
toAltAz(double,double,double,double,double,double,Point3DDouble)
method.public static Point3DDouble toAltAz(double x, double y, double z, double cx, double cy, double cz, Point3DDouble out)
out
- An optional (may be null) Point3DDouble that receives the
results to avoid allocations. If out is null, a new object will be
allocated. If out is an object, it will be modified in place with the
results and also returned.public static Point3DFloat cylindricalToXYZ(double r, double az, double h, double cx, double cy, double cz, Point3DFloat out)
r
- The radial distance in the x-y plane from the z axisaz
- The angle from the y axis (north) and increasing toward the
x axis (east.)h
- The height along the z axis.out
- An optional (may be null) Point3DFloat that receives the
results to avoid allocations. If this is null, a new object will be
allocated. If out is an object, it will be modified in place with the
results and also returned.public static Point3DFloat cylindricalToXYZ(Point3DDouble cyl, Point3DFloat out)
cyl
- A Point3DDouble which contains its coordinates as
(r, az, h)out
- An optional (may be null) Point3DFloat that receives the
results to avoid allocations. If out is null, a new object will be
allocated. If out is an object, it will be modified in place with the
results and also returned.public Point3DDouble toCylindrical()
toCylindrical(Point3DDouble)
method.public Point3DDouble toCylindrical(Point3DDouble out)
out
- An optional (may be null) Point3DDouble that receives the
results to avoid allocations. If out is null, a new object will be
allocated. If out is an object, it will be modified in place with the
results and also returned.public static Point3DDouble toCylindrical(double x, double y, double z)
toCylindrical(double,double,double,double,double,double,Point3DDouble)
method.public static Point3DDouble toCylindrical(double x, double y, double z, double cx, double cy, double cz, Point3DDouble out)
out
- An optional (may be null) Point3DDouble that receives the
results to avoid allocations. If out is null, a new object will be
allocated. If out is an object, it will be modified in place with the
results and also returned.public java.lang.String toString()
toString
in class java.lang.Object
public static double signum(double a)