OSDN Git Service

[更新]nyatlaブランチ
[nyartoolkit-and/nyartoolkit-and.git] / src / jp / nyatla / nyartoolkit / core / NyARTransMatResult.java
1 /* \r
2  * PROJECT: NyARToolkit\r
3  * --------------------------------------------------------------------------------\r
4  *\r
5  * The NyARToolkit is Java version ARToolkit class library.\r
6  * Copyright (C)2008 R.Iizuka\r
7  *\r
8  * This program is free software; you can redistribute it and/or\r
9  * modify it under the terms of the GNU General Public License\r
10  * as published by the Free Software Foundation; either version 2\r
11  * of the License, or (at your option) any later version.\r
12  * \r
13  * This program is distributed in the hope that it will be useful,\r
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
16  * GNU General Public License for more details.\r
17  * \r
18  * You should have received a copy of the GNU General Public License\r
19  * along with this framework; if not, write to the Free Software\r
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
21  * \r
22  * For further information please contact.\r
23  *      http://nyatla.jp/nyatoolkit/\r
24  *      <airmail(at)ebony.plala.or.jp>\r
25  * \r
26  */\r
27 package jp.nyatla.nyartoolkit.core;\r
28 \r
29 import jp.nyatla.nyartoolkit.*;\r
30 /**\r
31  * NyARTransMat戻り値専用のNyARMat\r
32  *\r
33  */\r
34 public class NyARTransMatResult extends NyARMat\r
35 {\r
36     private boolean has_value=false;\r
37     public NyARTransMatResult()\r
38     {\r
39         super(3,4);\r
40     }\r
41     /**\r
42      * この関数は使えません。\r
43      * @param i_row\r
44      * @param i_clm\r
45      * @throws NyARException\r
46      */\r
47     public NyARTransMatResult(int i_row,int i_clm) throws NyARException\r
48     {\r
49         super();//ここで例外発生\r
50     }\r
51     /**\r
52      * パラメータで変換行列を更新します。\r
53      * @param i_rot\r
54      * @param i_off\r
55      * @param i_trans\r
56      */\r
57     public void updateMatrixValue(NyARTransRot i_rot,double[] i_off,double[] i_trans)\r
58     {\r
59         double[] pa;\r
60         double[] rot=i_rot.getArray();\r
61 \r
62         pa=this.m[0];\r
63         pa[0] = rot[0*3+0];\r
64         pa[1] = rot[0*3+1];\r
65         pa[2] = rot[0*3+2];\r
66         pa[3] = rot[0*3+0]*i_off[0] + rot[0*3+1]*i_off[1] + rot[0*3+2]*i_off[2] + i_trans[0];\r
67 \r
68         pa=this.m[1];\r
69         pa[0] = rot[1*3+0];\r
70         pa[1] = rot[1*3+1];\r
71         pa[2] = rot[1*3+2];\r
72         pa[3] = rot[1*3+0]*i_off[0] + rot[1*3+1]*i_off[1] + rot[1*3+2]*i_off[2] + i_trans[1];\r
73 \r
74         pa=this.m[2];\r
75         pa[0] = rot[2*3+0];\r
76         pa[1] = rot[2*3+1];\r
77         pa[2] = rot[2*3+2];\r
78         pa[3] = rot[2*3+0]*i_off[0] + rot[2*3+1]*i_off[1] + rot[2*3+2]*i_off[2] + i_trans[2];\r
79 \r
80 \r
81         this.has_value=true;\r
82         return;\r
83     }\r
84     public void copyFrom(NyARTransMatResult i_from) throws NyARException\r
85     {\r
86         super.copyFrom(i_from);\r
87         this.has_value=i_from.has_value;\r
88     }\r
89     public boolean hasValue()\r
90     {\r
91         return this.has_value;\r
92     }\r
93 }\r