Record Class Vector3Dd
java.lang.Object
java.lang.Record
nl.pim16aap2.animatedarchitecture.core.util.vector.Vector3Dd
- All Implemented Interfaces:
IVector3D
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(double val) Adds a value to the x, y, and z values of the currentVector3Dd.add(double x, double y, double z) Adds values to the current values.Adds another 3D vector to the current values.ceil()Returns a new vector withMath.ceil(double)applied to the current values.Clamps the vector using a cuboid to provide the upper and lower limits.Clamps the vector to the provided upper and lower limits.divide(double val) Divides both the x, y, and z values of the currentVector3Ddwith a provided value.divide(double x, double y, double z) Divides the current values with values.Divides the x, y, and z values of the currentVector3Ddwith the x, y, and z values of the provided 3D vector.final booleanIndicates whether some other object is "equal to" this one.floor()Returns a new vector withMath.floor(double)applied to the current values.final inthashCode()Returns a hash code value for this object.doublemax()Returns the highest value in this vector.doublemin()Returns the lowest value in this vector.multiply(double val) Multiplies a value with both the x, y, and z values of the currentVector3Dd.multiply(double x, double y, double z) Multiplies values with the current values.Multiplies another 3D vector with the x, y, and z values of the currentVector3Dd.Normalizes thisVector3Dd.static Vector3DdrotateAroundXAxis(IVector3D pivotPoint, double radians) Rotates this point around another point along the x axis.rotateAroundYAxis(IVector3D pivotPoint, double radians) Rotates this point around another point along the y axis.rotateAroundZAxis(IVector3D pivotPoint, double radians) Rotates this point around another point along the z axis.round()Returns a new vector withMath.round(double)applied to the current values.subtract(double val) Subtracts a value from both the x, y, and z values of the currentVector3Dd.subtract(double x, double y, double z) Subtracts values from the current values.Subtracts another 3D vector from both the x, y, and z values of the currentVector3Dd.toDouble()Creates a new double-based 3d vector from this integer-based 3d vector.Creates a new integer-based 3d vector from this 3d vector.final StringtoString()Returns a string representation of this record class.toString(int decimals) Returns a String representation of this 3d vector.doublex()Returns the value of thexrecord component.doublexD()Returns the x value as double.doubley()Returns the value of theyrecord component.doubleyD()Returns the y value as double.doublez()Returns the value of thezrecord component.doublezD()Returns the z value as double.Methods inherited from interface IVector3D
getDistance, getDistance, magnitude, toDegrees, toLocation, toRadians
-
Constructor Details
-
Vector3Dd
-
Vector3Dd
public Vector3Dd(double x, double y, double z) Creates an instance of aVector3Ddrecord class.- Parameters:
x- the value for thexrecord componenty- the value for theyrecord componentz- the value for thezrecord component
-
-
Method Details
-
of
-
toInteger
Description copied from interface:IVector3DCreates a new integer-based 3d vector from this 3d vector.The values of a double-based vector will be rounded to obtain the integer values.
-
toDouble
-
add
Adds values to the current values.- Parameters:
x- The x value to add to the current x value.y- The y value to add to the current y value.z- The z value to add to the current z value.- Returns:
- A new
Vector3Ddwith the added values.
-
add
-
add
-
subtract
Subtracts values from the current values.- Parameters:
x- The x value to subtract from the current x value.y- The y value to subtract from the current y value.z- The z value to subtract from the current z value.- Returns:
- A new
Vector3Ddwith the subtracted values.
-
subtract
-
subtract
-
multiply
Multiplies values with the current values.- Parameters:
x- The x value to multiply with the current x value.y- The y value to multiply with the current y value.z- The z value to multiply with the current z value.- Returns:
- A new
Vector3Ddwith the multiplied values.
-
multiply
-
multiply
-
divide
Divides the current values with values.- Parameters:
x- The x value to use as divisor for the current x value.y- The y value to use as divisor for the current y value.z- The z value to use as divisor for the current z value.- Returns:
- A new
Vector3Ddwith the divided values.
-
divide
-
divide
-
normalized
-
toString
Returns a String representation of this 3d vector. The output will be the same astoString()with the only difference being that the x/y/z coordinate values will be formatted to a specific number of decimal places.- Parameters:
decimals- The number of decimals to print for each value.- Returns:
- A String representation of this vector.
-
rotateAroundXAxis
@CheckReturnValue @Contract(pure=true) public Vector3Dd rotateAroundXAxis(IVector3D pivotPoint, double radians) Rotates this point around another point along the x axis.- Parameters:
pivotPoint- The point around which to rotate this point.radians- How far to rotate this point (in radians).- Returns:
- A new
Vector3Ddrotated around the pivot point.
-
rotateAroundYAxis
@CheckReturnValue @Contract(pure=true) public Vector3Dd rotateAroundYAxis(IVector3D pivotPoint, double radians) Rotates this point around another point along the y axis.- Parameters:
pivotPoint- The point around which to rotate this point.radians- How far to rotate this point (in radians).- Returns:
- A new
Vector3Ddrotated around the pivot point.
-
rotateAroundZAxis
@CheckReturnValue @Contract(pure=true) public Vector3Dd rotateAroundZAxis(IVector3D pivotPoint, double radians) Rotates this point around another point along the z axis.- Parameters:
pivotPoint- The point around which to rotate this point.radians- How far to rotate this point (in radians).- Returns:
- A new
Vector3Ddrotated around the pivot point.
-
max
@CheckReturnValue @Contract(pure=true) public double max()Returns the highest value in this vector.- Returns:
- The highest value in this vector.
-
min
@CheckReturnValue @Contract(pure=true) public double min()Returns the lowest value in this vector.- Returns:
- The lowest value in this vector.
-
xD
-
yD
-
zD
-
floor
Description copied from interface:IVector3DReturns a new vector withMath.floor(double)applied to the current values.- Specified by:
floorin interfaceIVector3D- Returns:
- A new vector with
Math.floor(double)applied to the current values.
-
round
Description copied from interface:IVector3DReturns a new vector withMath.round(double)applied to the current values.- Specified by:
roundin interfaceIVector3D- Returns:
- A new vector with
Math.round(double)applied to the current values.
-
ceil
Description copied from interface:IVector3DReturns a new vector withMath.ceil(double)applied to the current values.- Specified by:
ceilin interfaceIVector3D- Returns:
- A new vector with
Math.ceil(double)applied to the current values.
-
clamp
-
clamp
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
x
public double x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
y
public double y()Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-
z
public double z()Returns the value of thezrecord component.- Returns:
- the value of the
zrecord component
-