| 1 |
/* |
|---|
| 2 |
* PROJECT: FLARToolKit |
|---|
| 3 |
* -------------------------------------------------------------------------------- |
|---|
| 4 |
* This work is based on the FLARToolKit developed by |
|---|
| 5 |
* R.Iizuka (nyatla) |
|---|
| 6 |
* http://nyatla.jp/nyatoolkit/ |
|---|
| 7 |
* |
|---|
| 8 |
* The FLARToolKit is ActionScript 3.0 version ARToolkit class library. |
|---|
| 9 |
* Copyright (C)2008 Saqoosha |
|---|
| 10 |
* |
|---|
| 11 |
* This program is free software: you can redistribute it and/or modify |
|---|
| 12 |
* it under the terms of the GNU General Public License as published by |
|---|
| 13 |
* the Free Software Foundation, either version 3 of the License, or |
|---|
| 14 |
* (at your option) any later version. |
|---|
| 15 |
* |
|---|
| 16 |
* This program is distributed in the hope that it will be useful, |
|---|
| 17 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 18 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 19 |
* GNU General Public License for more details. |
|---|
| 20 |
* |
|---|
| 21 |
* You should have received a copy of the GNU General Public License |
|---|
| 22 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 23 |
* |
|---|
| 24 |
* For further information please contact. |
|---|
| 25 |
* http://www.libspark.org/wiki/saqoosha/FLARToolKit |
|---|
| 26 |
* <saq(at)saqoosha.net> |
|---|
| 27 |
* |
|---|
| 28 |
*/ |
|---|
| 29 |
|
|---|
| 30 |
package org.libspark.flartoolkit.utils { |
|---|
| 31 |
|
|---|
| 32 |
public class ArrayUtil { |
|---|
| 33 |
|
|---|
| 34 |
public static function createJaggedArray(len:int, ...args):Array { |
|---|
| 35 |
var arr:Array = new Array(len); |
|---|
| 36 |
while (len--) { |
|---|
| 37 |
arr[len] = args.length ? createJaggedArray.apply(null, args) : 0; |
|---|
| 38 |
} |
|---|
| 39 |
return arr; |
|---|
| 40 |
} |
|---|
| 41 |
|
|---|
| 42 |
public static function create2d(height:int, width:int):Array { |
|---|
| 43 |
return createJaggedArray(height, width); |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
public static function create3d(depth:int, height:int, width:int):Array { |
|---|
| 47 |
return createJaggedArray(depth, height, width); |
|---|
| 48 |
} |
|---|
| 49 |
|
|---|
| 50 |
public static function copy(src:Array, srcPos:int, dest:Array, destPos:int, length:int):void { |
|---|
| 51 |
for (var i:int = 0; i < length; i++) { |
|---|
| 52 |
dest[destPos + i] = src[srcPos + i]; |
|---|
| 53 |
} |
|---|
| 54 |
} |
|---|
| 55 |
} |
|---|
| 56 |
} |
|---|