Xj3D VRML/X3D Code API

org.web3d.util
Class ArrayUtils

java.lang.Object
  extended byorg.web3d.util.ArrayUtils

public class ArrayUtils
extends java.lang.Object

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.3 $
Author:
Justin Couch

Constructor Summary
ArrayUtils()
           
 
Method Summary
static 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayUtils

public ArrayUtils()
Method Detail

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 flattened
size - The number of items to copy from the in array
out - 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 flattened
size - The number of items to copy from the in array
out - 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 flattened
size - The number of items to copy from the in array
out - 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 flattened
size - The number of items to copy from the in array
width - The number of items in the second dimension
out - 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 flattened
size - The number of items to copy from the in array
out - 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 flattened
size - The number of items to copy from the in array
out - 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 flattened
size - The number of items to copy from the in array
width - The number of items in the second dimension
out - 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 raised
size - The number of vectors to copy from the in array
out - 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 raised
size - The number of vectors to copy from the in array
out - 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 raised
size - The number of vectors to copy from the in array
out - 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 raised
size - The number of vectors to copy from the in array
width - The size of the vectors
out - 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 raised
size - The number of vectors to copy from the in array
out - 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 raised
size - The number of vectors to copy from the in array
out - 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 raised
size - The number of vectors to copy from the in array
out - 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 raised
size - The number of vectors to copy from the in array
width - The size of the vectors
out - The output array to write the values to

Xj3D VRML/X3D Code API

Copyright © 2001 - 2005 Web3D Consortium