Here you can find the source of flatten4(float[][] in, int size, float[] out)
Parameter | Description |
---|---|
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 |
public static void flatten4(float[][] in, int size, float[] out)
//package com.java2s; /***************************************************************************** * Web3d.org Copyright (c) 2001 - 2006 * Java Source * * This source is licensed under the GNU LGPL v2.1 * Please read http://www.gnu.org/copyleft/lgpl.html for more information * * This software comes with the standard NO WARRANTY disclaimer for any * purpose. Use it at your own risk. If there's a problem you get to fix it. * ****************************************************************************/ public class Main { /**/*from w ww . j av a 2s . com*/ * Flatten a 2D array with 4 items in the second dimension into a 1D array. * * @param in The array to be flattened * @param size The number of items to copy from the in array * @param out The output array to write the values to */ public static void flatten4(float[][] in, int size, float[] out) { int count = size * 4 - 1; for (int i = size; --i >= 0;) { out[count--] = in[i][3]; out[count--] = in[i][2]; out[count--] = in[i][1]; out[count--] = in[i][0]; } } }