public final class Polar extends Object implements IEquatable<Polar>, IEquatableEpsilon<Polar>, ImmutableValueType
The corresponding 3-dimensional coordinates are Cylindrical coordinates.
| Constructor and Description |
|---|
Polar()
Initializes a new instance.
|
Polar(double[] elements)
Initializes a set of
Polar coordinates from the first 2 consecutive elements in the provided array. |
Polar(double[] elements,
int startIndex)
Initializes a set of
Polar coordinates from 2 consecutive elements in the provided array. |
Polar(double clock,
double radial)
Initializes a set of
Polar coordinates from the provided values. |
Polar(Rectangular coordinates)
Initializes a set of
Polar coordinates from the provided set of Rectangular coordinates. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj)
Indicates whether another object is exactly equal to this instance.
|
static boolean |
equals(Polar left,
Polar right)
Returns
true if the two instances are exactly equal. |
boolean |
equalsEpsilon(Polar 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(Polar 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.
|
int |
getLength()
Gets the number of elements in this set of coordinates.
|
double |
getRadial()
Gets the linear coordinate perpendicular to the z-axis.
|
static Polar |
getZero()
Gets a set of
Polar coordinates with values of zero. |
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(Polar left,
Polar right)
Returns
true if the two instances are not exactly equal. |
String |
toString()
Returns the string representation of the value of this instance.
|
public Polar()
public Polar(double clock,
double radial)
Polar coordinates from the provided values.clock - The angular coordinate lying in the xy-plane measured from the positive x-axis and toward the positive y-axis.radial - The linear coordinate perpendicular to the z-axis.public Polar(@Nonnull Rectangular coordinates)
Polar coordinates from the provided set of Rectangular coordinates.coordinates - The set of Rectangular coordinates.public Polar(@Nonnull double[] elements)
Polar 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 Polar(@Nonnull double[] elements, int startIndex)
Polar coordinates from 2 consecutive elements in 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 getRadial()
public final int getLength()
public final double get(int index)
index of 0 and 1 corresponding to the coordinates
Clock (get), and Radial (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 Objectobj - 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(),
HashMappublic final boolean equalsType(@Nonnull Polar other)
equalsType in interface IEquatable<Polar>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 Polar other, double epsilon)
equalsEpsilon in interface IEquatableEpsilon<Polar>other - The set of Polar 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 ObjectObject.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)public String toString()
public static boolean equals(@Nonnull Polar left, @Nonnull Polar 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 Polar left, @Nonnull Polar 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.