Record Class Vector3Di
java.lang.Object
java.lang.Record
nl.pim16aap2.animatedarchitecture.core.util.vector.Vector3Di
- All Implemented Interfaces:
IVector3D
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabsolute()Gets the absolute values of this vector.add(double val) Adds a floating point value to the x, y, and z values of the currentVector3Di.add(double x, double y, double z) Adds floating point values to the current x/y/z.add(int val) Adds an integer value to the x, y, and z values of the currentVector3Di.add(int x, int y, int z) Adds integer values to the current values.Adds anotherVector3Ddto the current values.Adds anotherVector3Dito the current values.ceil()Returns a new vector withMath.ceil(double)applied to the current values.divide(double val) Divides the x, y, and z values of the currentVector3Diwith a provided value.divide(double x, double y, double z) Divides the current values with values.divide(int val) Divides the x, y, and z values of the currentVector3Diwith a provided value.divide(int x, int y, int z) Divides the current values with values.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.leftShift(int bits) Signed bitwise left shift the values in this vector.intmax()Returns the highest value in this vector.intmin()Returns the lowest value in this vector.multiply(double val) Multiplies a value with the x, y, and z values of the currentVector3Di.multiply(double x, double y, double z) Multiplies values with the current values.multiply(int val) Multiplies a value with the x, y, and z values of the currentVector3Di.multiply(int x, int y, int z) Multiplies values with the current values.Normalizes thisVector3Di.static Vector3DirightShift(int bits) Signed bitwise right shift the values in this vector.rotateAroundXAxis(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 floating point value from the x, y, and z values of the currentVector3Di.subtract(double x, double y, double z) Subtracts floating point values from the current values.subtract(int val) Subtracts a value from the x, y, and z values of the currentVector3Di.subtract(int x, int y, int z) Subtracts values from the current values.intsum()Returns the sum of the x, y, and z values.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.intx()Returns the value of thexrecord component.doublexD()Returns the x value as double.inty()Returns the value of theyrecord component.doubleyD()Returns the y value as double.intz()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
-
Vector3Di
-
Vector3Di
public Vector3Di(int x, int y, int z) Creates an instance of aVector3Direcord 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 integer 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
Vector3Diwith the added values.
-
add
Adds floating point values to the current x/y/z.- 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
-
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
Vector3Diwith the subtracted values.
-
subtract
Subtracts floating point 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
-
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
Vector3Diwith the multiplied values.
-
multiply
-
multiply
-
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.- Returns:
- A new
Vector3Diwith the divided values.
-
divide
-
divide
-
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
Vector3Diwith the divided values.
-
divide
-
divide
-
normalized
-
rotateAroundXAxis
@CheckReturnValue @Contract(pure=true) public Vector3Di 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
Vector3Dirotated around the pivot point.
-
rotateAroundYAxis
@CheckReturnValue @Contract(pure=true) public Vector3Di 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
Vector3Dirotated around the pivot point.
-
rotateAroundZAxis
@CheckReturnValue @Contract(pure=true) public Vector3Di 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
Vector3Dirotated around the pivot point.
-
leftShift
-
rightShift
-
absolute
-
max
@CheckReturnValue @Contract(pure=true) public int max()Returns the highest value in this vector.- Returns:
- The highest value in this vector.
-
min
@CheckReturnValue @Contract(pure=true) public int min()Returns the lowest value in this vector.- Returns:
- The lowest value in this vector.
-
sum
public int sum()Returns the sum of the x, y, and z values.- Returns:
- The sum of the x, y, and z values.
-
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.
-
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 int x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
y
public int y()Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-
z
public int z()Returns the value of thezrecord component.- Returns:
- the value of the
zrecord component
-