public final class UnitSpherical extends Object implements IEquatable<UnitSpherical>, IEquatableEpsilon<UnitSpherical>, ImmutableValueType
Constructor and Description |
---|
UnitSpherical()
Initializes a new instance.
|
UnitSpherical(double[] elements)
Initializes a set of
UnitSpherical coordinates from the first 2 consecutive elements in the provided array. |
UnitSpherical(double[] elements,
int startIndex)
Initializes a set of
UnitSpherical coordinates from the provided array. |
UnitSpherical(double clock,
double cone)
Initializes a set of
UnitSpherical coordinates from the provided clock angle and cone angle. |
UnitSpherical(Spherical coordinates)
Initializes a set of
UnitSpherical coordinates from the provided set of
Spherical coordinates. |
UnitSpherical(UnitCartesian coordinates)
Initializes a set of
UnitSpherical coordinates from the provided set of UnitCartesian coordinates. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Indicates whether another object is exactly equal to this instance.
|
static boolean |
equals(UnitSpherical left,
UnitSpherical right)
Returns
true if the two instances are exactly equal. |
boolean |
equalsEpsilon(UnitSpherical other,
double epsilon)
Indicates whether each coordinate value of another instance of this type
is within the required tolerance of the corresponding coordinate value of this instance.
|
boolean |
equalsType(UnitSpherical other)
Indicates whether another instance of this type is exactly equal to this instance.
|
double |
get(int index)
|
double |
getClock()
Gets the angular coordinate lying in the xy-plane measured from the positive x-axis and toward the positive y-axis.
|
double |
getCone()
Gets the angular coordinate measured from the positive z-axis and toward the negative z-axis.
|
int |
getLength()
Gets the number of elements in this set of coordinates.
|
double |
getMagnitude()
Gets the linear coordinate measured from the origin.
|
int |
hashCode()
Returns a hash code for this instance, which is suitable for use in hashing algorithms and data structures like a hash table.
|
static boolean |
notEquals(UnitSpherical left,
UnitSpherical right)
Returns
true if the two instances are not exactly equal. |
String |
toString()
Returns the string representation of the value of this instance.
|
public UnitSpherical()
public UnitSpherical(double clock, double cone)
UnitSpherical
coordinates from the provided clock angle and cone angle.clock
- The angular coordinate lying in the xy-plane measured from the positive x-axis and toward the positive y-axis.cone
- The angular coordinate measured from the positive z-axis and toward the negative z-axis.public UnitSpherical(@Nonnull UnitCartesian coordinates)
UnitSpherical
coordinates from the provided set of UnitCartesian
coordinates.coordinates
- The set of UnitCartesian
coordinates.public UnitSpherical(@Nonnull Spherical coordinates)
UnitSpherical
coordinates from the provided set of
Spherical
coordinates.coordinates
- The set of Spherical coordinates.public UnitSpherical(@Nonnull double[] elements)
UnitSpherical
coordinates from the first 2 consecutive elements in the provided array.elements
- The array of coordinate values.ArgumentNullException
- Thrown when elements
is null
.ArgumentOutOfRangeException
- An object of this type must be constructed from an array with at least 2 elements
.public UnitSpherical(@Nonnull double[] elements, int startIndex)
UnitSpherical
coordinates from the provided array.elements
- The array of coordinate values.startIndex
- The index of the first element in the array to use.ArgumentNullException
- Thrown when elements
is null
.ArgumentOutOfRangeException
- Thrown when an object of this type is constructed from an array with less than 2 elements
.public final double getClock()
public final double getCone()
public final double getMagnitude()
public final int getLength()
public final double get(int index)
index
of 0 and 1 corresponding to the coordinates
Clock
(get
) and Cone
(get
).index
- The index to retrieve.index
.ArgumentOutOfRangeException
- Thrown when index
is less than 0 or greater than or equal to Length
(get
).public boolean equals(Object obj)
equals
in class Object
obj
- The object to compare to this instance.true
if obj
is an instance of this type and represents the same value as this instance; otherwise false
.Object.hashCode()
,
HashMap
public final boolean equalsType(@Nonnull UnitSpherical other)
equalsType
in interface IEquatable<UnitSpherical>
other
- The instance to compare to this instance.true
if other
represents the same value as this instance; otherwise false
.public final boolean equalsEpsilon(@Nonnull UnitSpherical other, double epsilon)
equalsEpsilon
in interface IEquatableEpsilon<UnitSpherical>
other
- The set of UnitSpherical
coordinates to compare to this instance.epsilon
- The limit at which the absolute differences between the coordinate values will not be considered equal.true
if the absolute differences are less than or equal to epsilon
; otherwise false
.public int hashCode()
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public String toString()
public static boolean equals(@Nonnull UnitSpherical left, @Nonnull UnitSpherical right)
true
if the two instances are exactly equal.left
- The instance to compare to right
.right
- The instance to compare to left
.true
if left
represents the same value as right
; otherwise false
.public static boolean notEquals(@Nonnull UnitSpherical left, @Nonnull UnitSpherical right)
true
if the two instances are not exactly equal.left
- The instance to compare to right
.right
- The instance to compare to left
.true
if left
does not represent the same value as right
; otherwise false
.