OSDN Git Service

[tag]NyARToolkit/2.5.1
[nyartoolkit-and/nyartoolkit-and.git] / tags / 2.5.1 / sample / sandbox / jp / nyatla / nyartoolkit / sandbox / x2 / NyARFixedFloatTransOffset.java
diff --git a/tags/2.5.1/sample/sandbox/jp/nyatla/nyartoolkit/sandbox/x2/NyARFixedFloatTransOffset.java b/tags/2.5.1/sample/sandbox/jp/nyatla/nyartoolkit/sandbox/x2/NyARFixedFloatTransOffset.java
new file mode 100644 (file)
index 0000000..ada1b61
--- /dev/null
@@ -0,0 +1,76 @@
+/* \r
+ * PROJECT: NyARToolkit\r
+ * --------------------------------------------------------------------------------\r
+ * This work is based on the original ARToolKit developed by\r
+ *   Hirokazu Kato\r
+ *   Mark Billinghurst\r
+ *   HITLab, University of Washington, Seattle\r
+ * http://www.hitl.washington.edu/artoolkit/\r
+ *\r
+ * The NyARToolkit is Java version ARToolkit class library.\r
+ * Copyright (C)2008 R.Iizuka\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ * \r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this framework; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ * \r
+ * For further information please contact.\r
+ *     http://nyatla.jp/nyatoolkit/\r
+ *     <airmail(at)ebony.plala.or.jp>\r
+ * \r
+ */\r
+package jp.nyatla.nyartoolkit.sandbox.x2;\r
+\r
+import jp.nyatla.nyartoolkit.core.types.*;\r
+import jp.nyatla.nyartoolkit.core.types.NyARFixedFloat16Point2d;\r
+import jp.nyatla.nyartoolkit.core.types.NyARFixedFloat16Point3d;\r
+\r
+\r
+final public class NyARFixedFloatTransOffset\r
+{\r
+       public NyARFixedFloat16Point3d[] vertex=NyARFixedFloat16Point3d.createArray(4);\r
+       public NyARFixedFloat16Point3d point=new NyARFixedFloat16Point3d();     \r
+       /**\r
+        * 中心位置と辺長から、オフセット情報を作成して設定する。\r
+        * @param i_width\r
+        * FF16で渡すこと!\r
+        * @param i_center\r
+        */\r
+       public void setSquare(long i_width,NyARFixedFloat16Point2d i_center)\r
+       {\r
+               final long w_2 = i_width>>1;\r
+               \r
+               NyARFixedFloat16Point3d vertex3d_ptr;\r
+               vertex3d_ptr= this.vertex[0];\r
+               vertex3d_ptr.x = -w_2;\r
+               vertex3d_ptr.y =  w_2;\r
+               vertex3d_ptr.z = 0;\r
+               vertex3d_ptr= this.vertex[1];\r
+               vertex3d_ptr.x = w_2;\r
+               vertex3d_ptr.y = w_2;\r
+               vertex3d_ptr.z = 0;\r
+               vertex3d_ptr= this.vertex[2];\r
+               vertex3d_ptr.x =  w_2;\r
+               vertex3d_ptr.y = -w_2;\r
+               vertex3d_ptr.z = 0;\r
+               vertex3d_ptr= this.vertex[3];\r
+               vertex3d_ptr.x = -w_2;\r
+               vertex3d_ptr.y = -w_2;\r
+               vertex3d_ptr.z = 0;\r
+               \r
+               this.point.x=-i_center.x;\r
+               this.point.y=-i_center.y;\r
+               this.point.z=0;\r
+               return;\r
+       }\r
+}\r