| 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 |
package org.libspark.flartoolkit.core.types |
|---|
| 30 |
{ |
|---|
| 31 |
|
|---|
| 32 |
public class FLARDoublePoint3d |
|---|
| 33 |
{ |
|---|
| 34 |
public var x:Number; |
|---|
| 35 |
public var y:Number; |
|---|
| 36 |
public var z:Number; |
|---|
| 37 |
/** |
|---|
| 38 |
* 配列ファクトリ |
|---|
| 39 |
* @param i_number |
|---|
| 40 |
* @return |
|---|
| 41 |
*/ |
|---|
| 42 |
public static function createArray(i_number:int):Vector.<FLARDoublePoint3d> |
|---|
| 43 |
{ |
|---|
| 44 |
var ret:Vector.<FLARDoublePoint3d>=new Vector.<FLARDoublePoint3d>(i_number); |
|---|
| 45 |
for(var i:int=0;i<i_number;i++) |
|---|
| 46 |
{ |
|---|
| 47 |
ret[i]=new FLARDoublePoint3d(); |
|---|
| 48 |
} |
|---|
| 49 |
return ret; |
|---|
| 50 |
} |
|---|
| 51 |
public function setValue(i_in:FLARDoublePoint3d):void |
|---|
| 52 |
{ |
|---|
| 53 |
this.x=i_in.x; |
|---|
| 54 |
this.y=i_in.y; |
|---|
| 55 |
this.z=i_in.z; |
|---|
| 56 |
return; |
|---|
| 57 |
} |
|---|
| 58 |
/** |
|---|
| 59 |
* p2-p1間の距離の二乗値を計算します。 |
|---|
| 60 |
* @param i_p1 |
|---|
| 61 |
* @return |
|---|
| 62 |
*/ |
|---|
| 63 |
public function sqDist(i_p1:FLARDoublePoint3d):Number |
|---|
| 64 |
{ |
|---|
| 65 |
var x:Number,y:Number,z:Number; |
|---|
| 66 |
x=this.x-i_p1.x; |
|---|
| 67 |
y=this.y-i_p1.y; |
|---|
| 68 |
z=this.z-i_p1.z; |
|---|
| 69 |
return x*x+y*y+z*z; |
|---|
| 70 |
} |
|---|
| 71 |
/** |
|---|
| 72 |
* この関数は、頂点を移動します。 |
|---|
| 73 |
* @param i_tx |
|---|
| 74 |
* 移動する距離x |
|---|
| 75 |
* @param i_ty |
|---|
| 76 |
* 移動する距離y |
|---|
| 77 |
* @param i_tz |
|---|
| 78 |
* 移動する距離z |
|---|
| 79 |
*/ |
|---|
| 80 |
public function translate(i_tx:Number,i_ty:Number,i_tz:Number):void |
|---|
| 81 |
{ |
|---|
| 82 |
this.x+=i_tx; |
|---|
| 83 |
this.y+=i_ty; |
|---|
| 84 |
this.z+=i_tz; |
|---|
| 85 |
} |
|---|
| 86 |
} |
|---|
| 87 |
} |
|---|