Package org.web3d.util
Class ArrayUtils
java.lang.Object
org.web3d.util.ArrayUtils
Utility class for doing array manipulation.
The main use of this class is to provide a central location that converts 2D arrays to flat structures and back again. All methods assume that you have passed a target array in of at least the minimum length. If you don't an array index exception will be generated.
- Version:
- $Revision: 1.4 $
- Author:
- Justin Couch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
flatten2
(double[][] in, int size, double[] out) Flatten a 2D array with 2 items in the second dimension into a 1D array.static void
flatten2
(float[][] in, int size, float[] out) Flatten a 2D array with 2 items in the second dimension into a 1D array.static void
flatten3
(double[][] in, int size, double[] out) Flatten a 2D array with 3 items in the second dimension into a 1D array.static void
flatten3
(float[][] in, int size, float[] out) Flatten a 2D array with 3 items in the second dimension into a 1D array.static void
flatten4
(float[][] in, int size, float[] out) Flatten a 2D array with 4 items in the second dimension into a 1D array.static void
flattenN
(double[][] in, int size, int width, double[] out) Flatten a 2D array with n items in the second dimension into a 1D array.static void
flattenN
(float[][] in, int size, int width, float[] out) Flatten a 2D array with n items in the second dimension into a 1D array.static void
raise2
(double[] in, int size, double[][] out) Raise a 1D array into a 2D array with 2 items in the second dimension.static void
raise2
(float[] in, int size, float[][] out) Raise a 1D array into a 2D array with 2 items in the second dimension.static void
raise3
(double[] in, int size, double[][] out) Raise a 1D array into a 2D array with 3 items in the second dimension.static void
raise3
(float[] in, int size, float[][] out) Raise a 1D array into a 2D array with 3 items in the second dimension.static void
raise4
(double[] in, int size, double[][] out) Raise a 1D array into a 2D array with 4 items in the second dimension.static void
raise4
(float[] in, int size, float[][] out) Raise a 1D array into a 2D array with 4 items in the second dimension.static void
raiseN
(double[] in, int size, int width, double[][] out) Raise a 1D array into a 2D array with N items in the second dimension.static void
raiseN
(float[] in, int size, int width, float[][] out) Raise a 1D array into a 2D array with N items in the second dimension.
-
Constructor Details
-
ArrayUtils
public ArrayUtils()
-
-
Method Details
-
flatten2
public static void flatten2(float[][] in, int size, float[] out) Flatten a 2D array with 2 items in the second dimension into a 1D array.- Parameters:
in
- The array to be flattenedsize
- The number of items to copy from the in arrayout
- The output array to write the values to
-
flatten3
public static void flatten3(float[][] in, int size, float[] out) Flatten a 2D array with 3 items in the second dimension into a 1D array.- Parameters:
in
- The array to be flattenedsize
- The number of items to copy from the in arrayout
- The output array to write the values to
-
flatten4
public static void flatten4(float[][] in, int size, float[] out) Flatten a 2D array with 4 items in the second dimension into a 1D array.- Parameters:
in
- The array to be flattenedsize
- The number of items to copy from the in arrayout
- The output array to write the values to
-
flattenN
public static void flattenN(float[][] in, int size, int width, float[] out) Flatten a 2D array with n items in the second dimension into a 1D array. Generic but slower then the static sized conterparts.- Parameters:
in
- The array to be flattenedsize
- The number of items to copy from the in arraywidth
- The number of items in the second dimensionout
- The output array to write the values to
-
flatten2
public static void flatten2(double[][] in, int size, double[] out) Flatten a 2D array with 2 items in the second dimension into a 1D array.- Parameters:
in
- The array to be flattenedsize
- The number of items to copy from the in arrayout
- The output array to write the values to
-
flatten3
public static void flatten3(double[][] in, int size, double[] out) Flatten a 2D array with 3 items in the second dimension into a 1D array.- Parameters:
in
- The array to be flattenedsize
- The number of items to copy from the in arrayout
- The output array to write the values to
-
flattenN
public static void flattenN(double[][] in, int size, int width, double[] out) Flatten a 2D array with n items in the second dimension into a 1D array.- Parameters:
in
- The array to be flattenedsize
- The number of items to copy from the in arraywidth
- The number of items in the second dimensionout
- The output array to write the values to
-
raise2
public static void raise2(float[] in, int size, float[][] out) Raise a 1D array into a 2D array with 2 items in the second dimension.- Parameters:
in
- The array to be raisedsize
- The number of vectors to copy from the in arrayout
- The output array to write the values to
-
raise3
public static void raise3(float[] in, int size, float[][] out) Raise a 1D array into a 2D array with 3 items in the second dimension.- Parameters:
in
- The array to be raisedsize
- The number of vectors to copy from the in arrayout
- The output array to write the values to
-
raise4
public static void raise4(float[] in, int size, float[][] out) Raise a 1D array into a 2D array with 4 items in the second dimension.- Parameters:
in
- The array to be raisedsize
- The number of vectors to copy from the in arrayout
- The output array to write the values to
-
raiseN
public static void raiseN(float[] in, int size, int width, float[][] out) Raise a 1D array into a 2D array with N items in the second dimension. Generic but slower then the static sized conterparts.- Parameters:
in
- The array to be raisedsize
- The number of vectors to copy from the in arraywidth
- The size of the vectorsout
- The output array to write the values to
-
raise2
public static void raise2(double[] in, int size, double[][] out) Raise a 1D array into a 2D array with 2 items in the second dimension.- Parameters:
in
- The array to be raisedsize
- The number of vectors to copy from the in arrayout
- The output array to write the values to
-
raise3
public static void raise3(double[] in, int size, double[][] out) Raise a 1D array into a 2D array with 3 items in the second dimension.- Parameters:
in
- The array to be raisedsize
- The number of vectors to copy from the in arrayout
- The output array to write the values to
-
raise4
public static void raise4(double[] in, int size, double[][] out) Raise a 1D array into a 2D array with 4 items in the second dimension.- Parameters:
in
- The array to be raisedsize
- The number of vectors to copy from the in arrayout
- The output array to write the values to
-
raiseN
public static void raiseN(double[] in, int size, int width, double[][] out) Raise a 1D array into a 2D array with N items in the second dimension. Generic but slower then the static sized conterparts.- Parameters:
in
- The array to be raisedsize
- The number of vectors to copy from the in arraywidth
- The size of the vectorsout
- The output array to write the values to
-