public final class Point3F
extends java.lang.Object
Point3
denotes a point in 3D-space.
This class is immutable and therefore thread-safe.
Modifier and Type | Field and Description |
---|---|
static Point3F |
MAXIMUM
The maximum
Point3F . |
static Point3F |
MINIMUM
The minimum
Point3F . |
float |
x
The X-coordinate.
|
float |
y
The Y-coordinate.
|
float |
z
The Z-coordinate.
|
Constructor and Description |
---|
Point3F()
Constructs a new
Point3F instance. |
Point3F(float x,
float y,
float z)
Constructs a new
Point3F instance given its coordinates. |
Point3F(Vector3F v)
Constructs a new
Point3F instance given a Vector3F . |
Modifier and Type | Method and Description |
---|---|
static Point3F |
center(Point3F a,
Point3F b)
Returns the center
Point3F given the bounds represented by a and b . |
float |
distanceTo(Point3F p)
Returns the distance from this
Point3F to p . |
float |
distanceToSquared(Point3F p)
Returns the distance from this
Point3F to p in squared form. |
boolean |
equals(java.lang.Object object)
Compares
object to this Point3F instance for equality. |
int |
hashCode()
Returns a hash code for this
Point3F instance. |
boolean |
isWithinSphereRadius(Point3F p,
float radius)
Returns
true if, and only if, p is contained in the sphere defined with the center as this Point3F instance and a radius of radius , false otherwise. |
static Point3F |
maximum()
Returns the maximum
Point3F . |
static Point3F |
maximum(Point3F a,
Point3F b)
Returns the maximum
Point3F given the bounds represented by a and b . |
static Point3F |
maximum(Point3F a,
Point3F b,
Point3F c)
Returns the maximum
Point3F given the bounds represented by a , b and c . |
static float |
maximumX(Point3F a,
Point3F b,
Point3F c)
Returns the maximum X-coordinate given the bounds represented by
a , b and c . |
static float |
maximumY(Point3F a,
Point3F b,
Point3F c)
Returns the maximum Y-coordinate given the bounds represented by
a , b and c . |
static float |
maximumZ(Point3F a,
Point3F b,
Point3F c)
Returns the maximum Z-coordinate given the bounds represented by
a , b and c . |
static Point3F |
minimum()
Returns the minimum
Point3F . |
static Point3F |
minimum(Point3F a,
Point3F b)
Returns the minimum
Point3F given the bounds represented by a and b . |
static Point3F |
minimum(Point3F a,
Point3F b,
Point3F c)
Returns the minimum
Point3F given the bounds represented by a , b and c . |
static float |
minimumX(Point3F a,
Point3F b,
Point3F c)
Returns the minimum X-coordinate given the bounds represented by
a , b and c . |
static float |
minimumY(Point3F a,
Point3F b,
Point3F c)
Returns the minimum Y-coordinate given the bounds represented by
a , b and c . |
static float |
minimumZ(Point3F a,
Point3F b,
Point3F c)
Returns the minimum Z-coordinate given the bounds represented by
a , b and c . |
Point3F |
pointAt(Vector3F v,
float t)
Returns a
Point3F offset from this Point3F in the direction of v and with the distance of t . |
java.lang.String |
toString()
Returns a
String representation of this Point3F instance. |
Point3F |
transform(Matrix44F m)
Performs a transformation.
|
Point3F |
transformAndDivide(Matrix44F m)
Performs a transformation and a divide.
|
Point3F |
translateX(float x)
Performs a translation on the X-axis.
|
Point3F |
translateY(float y)
Performs a translation on the Y-axis.
|
Point3F |
translateZ(float z)
Performs a translation on the Z-axis.
|
public static final Point3F MAXIMUM
Point3F
.public static final Point3F MINIMUM
Point3F
.public final float x
public final float y
public final float z
public Point3F()
Point3F
instance.
Calling this constructor is equivalent to the following:
new Point3F(0.0F, 0.0F, 0.0F)
public Point3F(float x, float y, float z)
Point3F
instance given its coordinates.x
- the X-coordinatey
- the Y-coordinatez
- the Z-coordinatepublic Point3F(Vector3F v)
Point3F
instance given a Vector3F
.
Calling this constructor is equivalent to the following:
new Point3F(v.x, v.y, v.z)
If v
is null
, a NullPointerException
will be thrown.v
- a Vector3
java.lang.NullPointerException
- thrown if, and only if, v
is null
public Point3F pointAt(Vector3F v, float t)
Point3F
offset from this Point3F
in the direction of v
and with the distance of t
.
If v
is null
, a NullPointerException
will be thrown.
v
- a Vector3F
with the direction of the Point3F
to returnt
- the distance to the Point3F
to returnPoint3F
offset from this Point3F
in the direction of v
and with the distance of t
java.lang.NullPointerException
- thrown if, and only if, v
is null
public Point3F transform(Matrix44F m)
Returns a new Point3F
with the result of the transformation.
If m
is null
, a NullPointerException
will be thrown.
m
- the Matrix44F
to perform the transformation withPoint3F
with the result of the transformationjava.lang.NullPointerException
- thrown if, and only if, m
is null
public Point3F transformAndDivide(Matrix44F m)
Returns a new Point3F
with the result of the transformation and division.
If m
is null
, a NullPointerException
will be thrown.
m
- the Matrix44F
to perform the transformation withPoint3F
with the result of the transformation and divisionjava.lang.NullPointerException
- thrown if, and only if, m
is null
public Point3F translateX(float x)
Returns a new Point3F
with the result of the translation.
x
- a delta value to add to the value of the X-coordinatePoint3F
with the result of the translationpublic Point3F translateY(float y)
Returns a new Point3F
with the result of the translation.
y
- a delta value to add to the value of the Y-coordinatePoint3F
with the result of the translationpublic Point3F translateZ(float z)
Returns a new Point3F
with the result of the translation.
z
- a delta value to add to the value of the Z-coordinatePoint3F
with the result of the translationpublic java.lang.String toString()
String
representation of this Point3F
instance.toString
in class java.lang.Object
String
representation of this Point3F
instancepublic boolean equals(java.lang.Object object)
object
to this Point3F
instance for equality.
Returns true
if, and only if, object
is an instance of Point3F
, and their respective values are equal, false
otherwise.
equals
in class java.lang.Object
object
- the Object
to compare to this Point3F
instance for equalitytrue
if, and only if, object
is an instance of Point3F
, and their respective values are equal, false
otherwisepublic boolean isWithinSphereRadius(Point3F p, float radius)
true
if, and only if, p
is contained in the sphere defined with the center as this Point3F
instance and a radius of radius
, false
otherwise.
If p
is null
, a NullPointerException
will be thrown.
p
- the Point3F
instance to checkradius
- the radius to usetrue
if, and only if, p
is contained in the sphere defined with the center as this Point3F
instance and a radius of radius
, false
otherwisejava.lang.NullPointerException
- thrown if, and only if, p
is null
public float distanceTo(Point3F p)
Point3F
to p
.
If p
is null
, a NullPointerException
will be thrown.
p
- a Point3F
instancePoint3F
to p
java.lang.NullPointerException
- thrown if, and only if, p
is null
public float distanceToSquared(Point3F p)
Point3F
to p
in squared form.
If p
is null
, a NullPointerException
will be thrown.
p
- a Point3F
instancePoint3
to p
in squared formjava.lang.NullPointerException
- thrown if, and only if, p
is null
public int hashCode()
Point3F
instance.hashCode
in class java.lang.Object
Point3F
instancepublic static Point3F center(Point3F a, Point3F b)
Point3F
given the bounds represented by a
and b
.
If either a
or b
are null
, a NullPointerException
will be thrown.
a
- one of the Point3F
s defining the boundsb
- one of the Point3F
s defining the boundsPoint3F
given the bounds represented by a
and b
java.lang.NullPointerException
- thrown if, and only if, either a
or b
are null
public static Point3F maximum()
Point3F
.Point3F
public static Point3F maximum(Point3F a, Point3F b)
Point3F
given the bounds represented by a
and b
.
If either a
or b
are null
, a NullPointerException
will be thrown.
a
- one of the Point3F
s defining the boundsb
- one of the Point3F
s defining the boundsPoint3F
given the bounds represented by a
and b
java.lang.NullPointerException
- thrown if, and only if, either a
or b
are null
public static Point3F maximum(Point3F a, Point3F b, Point3F c)
Point3F
given the bounds represented by a
, b
and c
.
If either a
, b
or c
are null
, a NullPointerException
will be thrown.
a
- one of the Point3F
s defining the boundsb
- one of the Point3F
s defining the boundsc
- one of the Point3F
s defining the boundsPoint3F
given the bounds represented by a
, b
and c
java.lang.NullPointerException
- thrown if, and only if, either a
, b
or c
are null
public static Point3F minimum()
Point3F
.Point3F
public static Point3F minimum(Point3F a, Point3F b)
Point3F
given the bounds represented by a
and b
.
If either a
or b
are null
, a NullPointerException
will be thrown.
a
- one of the Point3F
s defining the boundsb
- one of the Point3F
s defining the boundsPoint3F
given the bounds represented by a
and b
java.lang.NullPointerException
- thrown if, and only if, either a
or b
are null
public static Point3F minimum(Point3F a, Point3F b, Point3F c)
Point3F
given the bounds represented by a
, b
and c
.
If either a
, b
or c
are null
, a NullPointerException
will be thrown.
a
- one of the Point3F
s defining the boundsb
- one of the Point3F
s defining the boundsc
- one of the Point3F
s defining the boundsPoint3F
given the bounds represented by a
, b
and c
java.lang.NullPointerException
- thrown if, and only if, either a
, b
or c
are null
public static float maximumX(Point3F a, Point3F b, Point3F c)
a
, b
and c
.
If either a
, b
or c
are null
, a NullPointerException
will be thrown.
a
- one of the Point3F
s defining the boundsb
- one of the Point3F
s defining the boundsc
- one of the Point3F
s defining the boundsa
, b
and c
java.lang.NullPointerException
- thrown if, and only if, either a
, b
or c
are null
public static float maximumY(Point3F a, Point3F b, Point3F c)
a
, b
and c
.
If either a
, b
or c
are null
, a NullPointerException
will be thrown.
a
- one of the Point3F
s defining the boundsb
- one of the Point3F
s defining the boundsc
- one of the Point3F
s defining the boundsa
, b
and c
java.lang.NullPointerException
- thrown if, and only if, either a
, b
or c
are null
public static float maximumZ(Point3F a, Point3F b, Point3F c)
a
, b
and c
.
If either a
, b
or c
are null
, a NullPointerException
will be thrown.
a
- one of the Point3F
s defining the boundsb
- one of the Point3F
s defining the boundsc
- one of the Point3F
s defining the boundsa
, b
and c
java.lang.NullPointerException
- thrown if, and only if, either a
, b
or c
are null
public static float minimumX(Point3F a, Point3F b, Point3F c)
a
, b
and c
.
If either a
, b
or c
are null
, a NullPointerException
will be thrown.
a
- one of the Point3F
s defining the boundsb
- one of the Point3F
s defining the boundsc
- one of the Point3F
s defining the boundsa
, b
and c
java.lang.NullPointerException
- thrown if, and only if, either a
, b
or c
are null
public static float minimumY(Point3F a, Point3F b, Point3F c)
a
, b
and c
.
If either a
, b
or c
are null
, a NullPointerException
will be thrown.
a
- one of the Point3F
s defining the boundsb
- one of the Point3F
s defining the boundsc
- one of the Point3F
s defining the boundsa
, b
and c
java.lang.NullPointerException
- thrown if, and only if, either a
, b
or c
are null
public static float minimumZ(Point3F a, Point3F b, Point3F c)
a
, b
and c
.
If either a
, b
or c
are null
, a NullPointerException
will be thrown.
a
- one of the Point3F
s defining the boundsb
- one of the Point3F
s defining the boundsc
- one of the Point3F
s defining the boundsa
, b
and c
java.lang.NullPointerException
- thrown if, and only if, either a
, b
or c
are null