Class Quaternion4D
java.lang.Object
com.io7m.jtensors.core.quaternions.Quaternion4D
- All Implemented Interfaces:
Quaternion4DType,QuaternionReadable4DType
public final class Quaternion4D extends java.lang.Object implements Quaternion4DType
The type of 4D
double-typed quaternions.-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classQuaternion4D.BuilderBuilds instances of typeQuaternion4D. -
Method Summary
Modifier and Type Method Description static Quaternion4D.Builderbuilder()Creates a builder forQuaternion4D.static Quaternion4DcopyOf(Quaternion4DType instance)Creates an immutable copy of aQuaternion4DTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofQuaternion4Dthat have equal attribute values.inthashCode()Computes a hash code from attributes:x,y,z,w.static Quaternion4Dof(double x, double y, double z, double w)Construct a new immutableQuaternion4Dinstance.java.lang.StringtoString()Prints the immutable valueQuaternion4Dwith attribute values.doublew()Quaternion4DwithW(double value)Copy the current immutable object by setting a value for thewattribute.Quaternion4DwithX(double value)Copy the current immutable object by setting a value for thexattribute.Quaternion4DwithY(double value)Copy the current immutable object by setting a value for theyattribute.Quaternion4DwithZ(double value)Copy the current immutable object by setting a value for thezattribute.doublex()doubley()doublez()
-
Method Details
-
x
public double x()- Specified by:
xin interfaceQuaternion4DType- Specified by:
xin interfaceQuaternionReadable4DType- Returns:
- The value of the
xattribute
-
y
public double y()- Specified by:
yin interfaceQuaternion4DType- Specified by:
yin interfaceQuaternionReadable4DType- Returns:
- The value of the
yattribute
-
z
public double z()- Specified by:
zin interfaceQuaternion4DType- Specified by:
zin interfaceQuaternionReadable4DType- Returns:
- The value of the
zattribute
-
w
public double w()- Specified by:
win interfaceQuaternion4DType- Specified by:
win interfaceQuaternionReadable4DType- Returns:
- The value of the
wattribute
-
withX
Copy the current immutable object by setting a value for thexattribute. A value strict bits equality used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for x- Returns:
- A modified copy of the
thisobject
-
withY
Copy the current immutable object by setting a value for theyattribute. A value strict bits equality used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for y- Returns:
- A modified copy of the
thisobject
-
withZ
Copy the current immutable object by setting a value for thezattribute. A value strict bits equality used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for z- Returns:
- A modified copy of the
thisobject
-
withW
Copy the current immutable object by setting a value for thewattribute. A value strict bits equality used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for w- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(java.lang.Object another)This instance is equal to all instances ofQuaternion4Dthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()Computes a hash code from attributes:x,y,z,w.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()Prints the immutable valueQuaternion4Dwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
Construct a new immutableQuaternion4Dinstance.- Parameters:
x- The value for thexattributey- The value for theyattributez- The value for thezattributew- The value for thewattribute- Returns:
- An immutable Quaternion4D instance
-
copyOf
Creates an immutable copy of aQuaternion4DTypevalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable Quaternion4D instance
-
builder
Creates a builder forQuaternion4D.Quaternion4D.builder() .setX(double) // requiredx.setY(double) // requiredy.setZ(double) // requiredz.setW(double) // requiredw.build();- Returns:
- A new Quaternion4D builder
-