Class RotationTools.Rotator
java.lang.Object
com.github.yellowstonegames.grid.RotationTools.Rotator
- Enclosing class:
RotationTools
A wrapper around similar logic to
RotationTools, but with no allocation after construction.
Operates on a fixed dimension; create different Rotator instances to rotate different dimensions.
You can rotate a float array with length equal to dimension with rotate(float[], float[]).-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidrotate(float[] input, float[] output) A rotation method that uses this Rotator's rotation matrix and takes an input vector to rotate (as a 1D float array), and an output vector to write to (as a 1D float array), does the math to rotateinputusing this Rotator, and adds the results intooutput.voidrotate(float[] input, float[] output, int offsetOut) A rotation method that uses this Rotator's rotation matrix and takes an input vector to rotate (as a 1D float array), and an output vector to write to (as a 1D float array), and an offset into the output vector to start writing there, does the math to rotateinputusing this Rotator, and adds the results intooutputstarting atoffsetOut.voidrotate(float[] input, int offsetIn, float[] output, int offsetOut) A rotation method that uses this Rotator's rotation matrix and takes an input vector to rotate (as a 1D float array), an output vector to write to (as a 1D float array), and offsets into the input and output vectors to start reading from and writing to, then does the math to rotateinputusing this Rotator, and adds the results intooutputstarting atoffsetOut.
-
Field Details
-
dimension
public final int dimension -
random
-
-
Constructor Details
-
Rotator
public Rotator() -
Rotator
public Rotator(int dimension) -
Rotator
-
-
Method Details
-
randomize
public void randomize() -
rotate
public void rotate(float[] input, float[] output) A rotation method that uses this Rotator's rotation matrix and takes an input vector to rotate (as a 1D float array), and an output vector to write to (as a 1D float array), does the math to rotateinputusing this Rotator, and adds the results intooutput. This does not erase output before writing to it, so it can be called more than once to sum multiple rotations if so desired. The length of output can be arbitrarily large, so this is complete when it has completely processed rotation. That means this affectsdimensionitems in output. Almost always, bothinputand the writeable part ofoutputshould have a length equal todimension. -
rotate
public void rotate(float[] input, float[] output, int offsetOut) A rotation method that uses this Rotator's rotation matrix and takes an input vector to rotate (as a 1D float array), and an output vector to write to (as a 1D float array), and an offset into the output vector to start writing there, does the math to rotateinputusing this Rotator, and adds the results intooutputstarting atoffsetOut. This does not erase output before writing to it, so it can be called more than once to sum multiple rotations if so desired. The length of output can be arbitrarily large, so this is complete when it has completely processed rotation. That means this affectsdimensionitems in output. Almost always, bothinputand the writeable part ofoutputshould have a length equal todimension. -
rotate
public void rotate(float[] input, int offsetIn, float[] output, int offsetOut) A rotation method that uses this Rotator's rotation matrix and takes an input vector to rotate (as a 1D float array), an output vector to write to (as a 1D float array), and offsets into the input and output vectors to start reading from and writing to, then does the math to rotateinputusing this Rotator, and adds the results intooutputstarting atoffsetOut. This does not erase output before writing to it, so it can be called more than once to sum multiple rotations if so desired. The length of output can be arbitrarily large, so this is complete when it has completely processed rotation. That means this affectsdimensionitems in output, and likewise reads the same amount from input. Both the part ofinputafteroffsetInand the writeable part ofoutputshould have a length at least equal todimension.
-