public final class AngleF
extends java.lang.Object
AngleF
encapsulates angles in forms such as degrees and radians.
This class is immutable and therefore thread-safe.
Modifier and Type | Field and Description |
---|---|
float |
degrees
The angle in degrees.
|
float |
degreesMaximum
The maximum angle in degrees.
|
float |
degreesMinimum
The minimum angle in degrees.
|
float |
radians
The angle in radians.
|
float |
radiansMaximum
The maximum angle in radians.
|
float |
radiansMinimum
The minimum angle in radians.
|
Modifier and Type | Method and Description |
---|---|
AngleF |
add(AngleF angle)
Adds
angle to this AngleF instance. |
static AngleF |
degrees(float degrees)
Returns a new
AngleF instance based on an angle in degrees. |
static AngleF |
degrees(float degrees,
float degreesA,
float degreesB)
Returns a new
AngleF instance based on an angle in degrees and an interval of valid degrees. |
boolean |
equals(java.lang.Object object)
Compares
object to this AngleF instance for equality. |
static AngleF |
fieldOfView(float focalDistance,
float resolution)
Returns a Field of View (FoV)
AngleF based on focalDistance and resolution . |
float |
getDegrees()
Returns the angle in degrees.
|
float |
getDegreesMaximum()
Returns the maximum angle in degrees.
|
float |
getDegreesMinimum()
Returns the minimum angle in degrees.
|
float |
getRadians()
Returns the angle in radians.
|
float |
getRadiansMaximum()
Returns the maximum angle in radians.
|
float |
getRadiansMinimum()
Returns the minimum angle in radians.
|
AngleF |
half()
Returns a new
AngleF instance that represents half of this AngleF instance. |
int |
hashCode()
Returns a hash code for this
AngleF instance. |
static AngleF |
pitch(Point3F eye,
Point3F lookAt)
Returns a new pitch
AngleF instance based on eye and lookAt . |
static AngleF |
pitch(Vector3F direction)
Returns a new pitch
AngleF instance based on direction . |
static AngleF |
radians(float radians)
Returns a new
AngleF instance based on an angle in radians. |
static AngleF |
radians(float radians,
float radiansA,
float radiansB)
Returns a new
AngleF instance based on an angle in radians and an interval of valid radians. |
AngleF |
subtract(AngleF angle)
Subtracts
angle from this AngleF instance. |
java.lang.String |
toString()
Returns a
String representation of this AngleF instance. |
static AngleF |
yaw(Point3F eye,
Point3F lookAt)
Returns a new yaw
AngleF instance based on eye and lookAt . |
static AngleF |
yaw(Vector3F direction)
Returns a new yaw
AngleF instance based on direction . |
public final float degrees
public final float degreesMaximum
public final float degreesMinimum
public final float radians
public final float radiansMaximum
public final float radiansMinimum
public AngleF add(AngleF angle)
angle
to this AngleF
instance.
Returns a new AngleF
instance with the result of the addition.
If angle
is null
, a NullPointerException
will be thrown.
angle
- the AngleF
to addAngleF
instance with the result of the additionjava.lang.NullPointerException
- thrown if, and only if, angle
is null
public AngleF half()
AngleF
instance that represents half of this AngleF
instance.AngleF
instance that represents half of this AngleF
instancepublic AngleF subtract(AngleF angle)
angle
from this AngleF
instance.
Returns a new AngleF
instance with the result of the subtraction.
If angle
is null
, a NullPointerException
will be thrown.
angle
- the AngleF
to subtractAngleF
instance with the result of the subtractionjava.lang.NullPointerException
- thrown if, and only if, angle
is null
public java.lang.String toString()
String
representation of this AngleF
instance.toString
in class java.lang.Object
String
representation of this AngleF
instancepublic boolean equals(java.lang.Object object)
object
to this AngleF
instance for equality.
Returns true
if, and only if, object
is an instance of AngleF
, and their respective values are equal, false
otherwise.
equals
in class java.lang.Object
object
- the Object
to compare to this AngleF
instance for equalitytrue
if, and only if, object
is an instance of AngleF
, and their respective values are equal, false
otherwisepublic float getDegrees()
public float getDegreesMaximum()
public float getDegreesMinimum()
public float getRadians()
public float getRadiansMaximum()
public float getRadiansMinimum()
public int hashCode()
AngleF
instance.hashCode
in class java.lang.Object
AngleF
instancepublic static AngleF degrees(float degrees)
AngleF
instance based on an angle in degrees.
Calling this method is equivalent to the following:
AngleF.degrees(degrees, 0.0F, 360.0F)
degrees
- the angle in degreesAngleF
instance based on an angle in degreespublic static AngleF degrees(float degrees, float degreesA, float degreesB)
AngleF
instance based on an angle in degrees and an interval of valid degrees.degrees
- the angle in degreesdegreesA
- the degrees that represents one of the ends of the interval of valid degreesdegreesB
- the degrees that represents one of the ends of the interval of valid degreesAngleF
instance based on an angle in degrees and an interval of valid degreespublic static AngleF fieldOfView(float focalDistance, float resolution)
AngleF
based on focalDistance
and resolution
.
This method allows you to use resolution
in either X- or Y-direction. So, either width or height.
focalDistance
- the focal distance (also known as focal length}resolution
- the resolution in X- or Y-direction (width or height)AngleF
based on focalDistance
and resolution
public static AngleF pitch(Point3F eye, Point3F lookAt)
AngleF
instance based on eye
and lookAt
.
If either eye
or lookAt
are null
, a NullPointerException
will be thrown.
eye
- the Point3F
on which the "eye" is positionedlookAt
- the Point3F
to which the "eye" is lookingAngleF
instance based on eye
and lookAt
java.lang.NullPointerException
- thrown if, and only if, either eye
or lookAt
are null
public static AngleF pitch(Vector3F direction)
AngleF
instance based on direction
.
If direction
is null
, a NullPointerException
will be thrown.
direction
- a normalized direction Vector3F
AngleF
instance based on direction
java.lang.NullPointerException
- thrown if, and only if, direction
is null
public static AngleF radians(float radians)
AngleF
instance based on an angle in radians.
Calling this method is equivalent to the following:
AngleF.radians(radians, 0.0F, PI * 2.0F)
radians
- the angle in radiansAngleF
instance based on an angle in radianspublic static AngleF radians(float radians, float radiansA, float radiansB)
AngleF
instance based on an angle in radians and an interval of valid radians.radians
- the angle in radiansradiansA
- the radians that represents one of the ends of the interval of valid radiansradiansB
- the radians that represents one of the ends of the interval of valid radiansAngleF
instance based on an angle in radians and an interval of valid radianspublic static AngleF yaw(Point3F eye, Point3F lookAt)
AngleF
instance based on eye
and lookAt
.
If either eye
or lookAt
are null
, a NullPointerException
will be thrown.
eye
- the Point3F
on which the "eye" is positionedlookAt
- the Point3F
to which the "eye" is lookingAngleF
instance based on eye
and lookAt
java.lang.NullPointerException
- thrown if, and only if, either eye
or lookAt
are null
public static AngleF yaw(Vector3F direction)
AngleF
instance based on direction
.
If direction
is null
, a NullPointerException
will be thrown.
direction
- a normalized direction Vector3F
AngleF
instance based on direction
java.lang.NullPointerException
- thrown if, and only if, direction
is null