Develop and Download Open Source Software

Browse Subversion Repository

Diff of /nyar4psg/trunk/src/src/jp/nyatla/nyar4psg/NyARPsgBaseClass.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 420 by nyatla, Sun Jan 31 12:01:43 2010 UTC revision 814 by nyatla, Sat Apr 16 16:28:43 2011 UTC
# Line 26  Line 26 
26   */   */
27    
28  package jp.nyatla.nyar4psg;  package jp.nyatla.nyar4psg;
29  import javax.media.opengl.GL;  
30    
31  import processing.core.*;  import processing.core.*;
 import processing.opengl.PGraphicsOpenGL;  
32    
33  import jp.nyatla.nyartoolkit.*;  import jp.nyatla.nyartoolkit.*;
 import jp.nyatla.nyartoolkit.core.*;  
 import jp.nyatla.nyartoolkit.core.squaredetect.*;  
34  import jp.nyatla.nyartoolkit.core.param.*;  import jp.nyatla.nyartoolkit.core.param.*;
35  import jp.nyatla.nyartoolkit.core.transmat.NyARTransMatResult;  import jp.nyatla.nyartoolkit.core.transmat.*;
36  import jp.nyatla.nyartoolkit.core.types.*;  import jp.nyatla.nyartoolkit.core.types.matrix.NyARDoubleMatrix44;
   
37    
38    class NyPsUtils
39    {
40            public static void dumpObject(PMatrix3D i_mat)
41            {
42                    PApplet.println("PMatrix3D");
43                    PApplet.println(String.format("%f %f %f %f",i_mat.m00,i_mat.m01,i_mat.m02,i_mat.m03));
44                    PApplet.println(String.format("%f %f %f %f",i_mat.m10,i_mat.m11,i_mat.m12,i_mat.m13));
45                    PApplet.println(String.format("%f %f %f %f",i_mat.m20,i_mat.m21,i_mat.m22,i_mat.m23));
46                    PApplet.println(String.format("%f %f %f %f",i_mat.m30,i_mat.m31,i_mat.m32,i_mat.m33));
47            }
48            public static void dumpObject(double[] i_val)
49            {
50                    PApplet.println("double[]");
51                    for(int i=0;i<i_val.length;i++){
52                            PApplet.println(i_val[i]);
53                    }
54            }
55    }
56    
57  /**  /**
58   * NyARToolkit for Processingのベースクラス。   * このクラスは、NyARToolkit for Processingのベースクラスです。
59   * カメラパラメータに関する機能、そのたすべてのユースケースで使用する機能を提供します。   * ARToolkit座標系の環境定数、環境設定機能を継承クラスに対して提供します。
  * @author nyatla  
  *  
60   */   */
61  class NyARPsgBaseClass  class NyARPsgBaseClass
62  {  {
63          /**          /**
64           * RightHand座標系であることを示します。           * 定数値です。この値はコンストラクタで使います。
65           * この値はコンストラクタで使います。           * RightHand系の座標を構築します。
66             * RightHand座標系は、ARToolKitと互換性のある座標系ですが、Processingの座標系と互換性がありません。(そのため、text等の出力が鏡像になります。)
67           * <br/>EN: -           * <br/>EN: -
68           */           */
69          public final static int CS_RIGHT=0;          public final static int CS_RIGHT_HAND=0;
70          /**          /**
71           * LeftHand座標系であることを示します。           * 定数値です。この値はコンストラクタで使います。
72           * この値はコンストラクタで使います。           * LeftHand座標系を構築します。
73             * RightHand座標系は、ARToolKitと互換性のない座標系ですが、Processingの座標系と互換性があります。
74             * processing関数で描画する場合は、こちらを選択してください。
75           * <br/>EN: -           * <br/>EN: -
76           */           */
77          public final static int CS_LEFT =1;          public final static int CS_LEFT_HAND =1;
78          /**          /**
79           * バージョン文字列です。           * バージョン文字列です。
80             * NyAR4psgのバージョン情報を示します。
81           * <br/>EN:           * <br/>EN:
82           * version string.           * version string.
83           */           */
84          public final String VERSION = "NyAR4psg/0.3.0;NyARToolkit for java/2.5.0+;ARToolKit/2.72.1";          public final String VERSION = "NyAR4psg/0.4.1;NyARToolkit for java/3.0.0;ARToolKit/2.72.1";
85          /**          /**
86           * OpenGLスタイルのProjectionMatrixです。           * OpenGLスタイルのProjectionMatrixです。
87           * <br/>EN:           * <br/>EN:
88           * OpenGL form projection matrix.           * OpenGL form projection matrix.
89           */           */
90          public final double[] projection=new double[16];          public final double[] projection=new double[16];
91            /**
92             * ProcessingスタイルのProjectionMatrixです。
93             */
94          protected PMatrix3D _ps_projection=new PMatrix3D();          protected PMatrix3D _ps_projection=new PMatrix3D();
95          protected PApplet _pa;          /**
96             * 参照するAppletのインスタンスです。
97             */
98            protected PApplet _ref_papplet;
99            /**
100             * ARToolkitパラメータのインスタンスです。
101             */
102          protected NyARParam _ar_param;          protected NyARParam _ar_param;
103          protected NyARPsgBaseClass(PApplet parent,String i_cparam_file, int i_width,int i_htight,int i_projection_coord_system)          protected NyARFrustum _frustum;
104            protected int _coord_system;
105            protected NyARPsgBaseClass(PApplet parent,String i_cparam_file, int i_width,int i_height,int i_coord_system)
106          {          {
107                  checkCoordinateSystemRange(parent,i_projection_coord_system);                  checkCoordinateSystemRange(parent,i_coord_system);
108                  this._pa=parent;                  this._ref_papplet=parent;
109                    this._coord_system=i_coord_system;
110                  try{                  try{
111                            this._frustum=new NyARFrustum();
112                          this._ar_param=new NyARParam();                          this._ar_param=new NyARParam();
113                          this._ar_param.loadARParam(this._pa.createInput(i_cparam_file));                          this._ar_param.loadARParam(this._ref_papplet.createInput(i_cparam_file));
114                          this._ar_param.changeScreenSize(i_width, i_htight);                          this._ar_param.changeScreenSize(i_width, i_height);
115                          initProjection(parent,this._ar_param,i_projection_coord_system);  
116                            //ProcessingのprojectionMatrixの計算と、Frustumの計算
117                            arPerspectiveMat2Projection(this._ar_param.getPerspectiveProjectionMatrix(),i_width,i_height,this._ps_projection,this.projection,this._frustum);
118                  }catch(NyARException e){                  }catch(NyARException e){
119                          this._pa.die("Error while setting up NyARToolkit for java", e);                          this._ref_papplet.die("Error while setting up NyARToolkit for java", e);
120                  }                  }
121                  return;                  return;
122          }          }
123          private void initProjection(PApplet i_pa, NyARParam i_param,int i_coord_system)          private final static double view_distance_min = 100;
124          {          private final static double view_distance_max = 100000;
                 NyARMat trans_mat = new NyARMat(3, 4);  
                 NyARMat icpara_mat = new NyARMat(3, 4);  
                 double[][] p = new double[3][3], q = new double[4][4];  
                 int i, j;  
   
                 final NyARIntSize size=i_param.getScreenSize();  
                 final int width = size.w;  
                 final int height = size.h;  
                   
                 i_param.getPerspectiveProjectionMatrix().decompMat(icpara_mat, trans_mat);  
   
                 double[][] icpara = icpara_mat.getArray();  
                 double[][] trans = trans_mat.getArray();  
                 for (i = 0; i < 4; i++) {  
                         icpara[1][i] = (height - 1) * (icpara[2][i]) - icpara[1][i];  
                 }  
   
                 for (i = 0; i < 3; i++) {  
                         for (j = 0; j < 3; j++) {  
                                 p[i][j] = icpara[i][j] / icpara[2][2];  
                         }  
                 }  
                 q[0][0] = (2.0 * p[0][0] / (width - 1));  
                 q[0][1] = (2.0 * p[0][1] / (width - 1));  
                 q[0][2] = -((2.0 * p[0][2] / (width - 1)) - 1.0);  
                 q[0][3] = 0.0;  
   
                 q[1][0] = 0.0;  
                 q[1][1] = -(2.0 * p[1][1] / (height - 1));  
                 q[1][2] = -((2.0 * p[1][2] / (height - 1)) - 1.0);  
                 q[1][3] = 0.0;  
   
                 q[2][0] = 0.0;  
                 q[2][1] = 0.0;  
                 q[2][2] = (view_distance_max + view_distance_min) / (view_distance_min - view_distance_max);  
                 q[2][3] = 2.0 * view_distance_max * view_distance_min / (view_distance_min - view_distance_max);  
   
                 q[3][0] = 0.0;  
                 q[3][1] = 0.0;  
                 q[3][2] = -1.0;  
                 q[3][3] = 0.0;  
                   
                 switch(i_coord_system){  
                 case NyARPsgBaseClass.CS_LEFT:  
                         break;  
                 case NyARPsgBaseClass.CS_RIGHT:  
                         q[2][2] = q[2][2]* -1;  
                         q[2][3] = q[2][3]* -1;  
                         break;  
                 default:  
                         i_pa.die("Please set NyARBoard.CS_LEFT or NyARBoard.CS_RIGHT.");  
                 }  
                   
                 for (i = 0; i < 4; i++) { // Row.  
                         // First 3 columns of the current row.  
                         for (j = 0; j < 3; j++) { // Column.  
                                 this.projection[i + j * 4] = q[i][0] * trans[0][j] + q[i][1] * trans[1][j] + q[i][2] * trans[2][j];  
                         }  
                         // Fourth column of the current row.  
                         this.projection[i + 3 * 4] = q[i][0] * trans[0][3] + q[i][1] * trans[1][3] + q[i][2] * trans[2][3] + q[i][3];  
                 }  
                   
                 //processingのProjectionMatrixも計算して保存する。  
                 this._ps_projection.m00=(float)this.projection[0];  
                 this._ps_projection.m01=(float)this.projection[1];  
                 this._ps_projection.m02=(float)this.projection[2];  
                 this._ps_projection.m03=(float)this.projection[3];  
                 this._ps_projection.m10=(float)this.projection[4];  
                 this._ps_projection.m11=(float)this.projection[5];  
                 this._ps_projection.m12=(float)this.projection[6];  
                 this._ps_projection.m13=(float)this.projection[7];  
                 this._ps_projection.m20=(float)this.projection[8];  
                 this._ps_projection.m21=(float)this.projection[9];  
                 this._ps_projection.m22=(float)this.projection[10];  
                 this._ps_projection.m23=(float)this.projection[11];  
                 this._ps_projection.m30=(float)this.projection[12];  
                 this._ps_projection.m31=(float)this.projection[13];  
                 this._ps_projection.m32=(float)this.projection[14];  
                 this._ps_projection.m33=(float)this.projection[15];  
                 this._ps_projection.transpose();  
   
                 return;  
         }  
   
           
         private final static double view_distance_min = 100;//#define VIEW_DISTANCE_MIN         0.1                     // Objects closer to the camera than this will not be displayed.  
         private final static double view_distance_max = 100000;//#define VIEW_DISTANCE_MAX              100.0           // Objects further away from the camera than this will not be displayed.  
125          private final static void checkCoordinateSystemRange(PApplet i_pa,int i_cs)          private final static void checkCoordinateSystemRange(PApplet i_pa,int i_cs)
126          {          {
127                  switch(i_cs){                  switch(i_cs){
128                  case NyARPsgBaseClass.CS_LEFT:                  case NyARPsgBaseClass.CS_LEFT_HAND:
129                  case NyARPsgBaseClass.CS_RIGHT:                  case NyARPsgBaseClass.CS_RIGHT_HAND:
130                          return;                          return;
131                  default:                  default:
132                          i_pa.die("Please set constant CS_LEFT or CS_RIGHT.");                          i_pa.die("Please set constant CS_LEFT_HAND or CS_RIGHT_HAND.");
133                  }                  }
134          }          }
135          private static double view_scale_factor = 1.0;          private static void arPerspectiveMat2Projection(NyARPerspectiveProjectionMatrix i_prjmat,int i_w,int i_h,PMatrix3D o_projection,double[] o_gl_projection,NyARFrustum o_frustum)
136            {
137                    NyARDoubleMatrix44 tmp=new NyARDoubleMatrix44();
138                    i_prjmat.makeCameraFrustumRH(i_w, i_h, view_distance_min, view_distance_max,tmp);
139                    o_projection.m00=(float)(o_gl_projection[ 0]=tmp.m00);
140                    o_projection.m01=(float)(o_gl_projection[ 1]=tmp.m10);
141                    o_projection.m02=(float)(o_gl_projection[ 2]=tmp.m20);
142                    o_projection.m03=(float)(o_gl_projection[ 3]=tmp.m30);
143                    o_projection.m10=(float)(o_gl_projection[ 4]=tmp.m01);
144                    o_projection.m11=(float)(o_gl_projection[ 5]=tmp.m11);
145                    o_projection.m12=(float)(o_gl_projection[ 6]=tmp.m21);
146                    o_projection.m13=(float)(o_gl_projection[ 7]=tmp.m31);
147                    o_projection.m20=(float)(o_gl_projection[ 8]=tmp.m02);
148                    o_projection.m21=(float)(o_gl_projection[ 9]=tmp.m12);
149                    o_projection.m22=(float)(o_gl_projection[10]=tmp.m22);
150                    o_projection.m23=(float)(o_gl_projection[11]=tmp.m32);
151                    o_projection.m30=(float)(o_gl_projection[12]=tmp.m03);
152                    o_projection.m31=(float)(o_gl_projection[13]=tmp.m13);
153                    o_projection.m32=(float)(o_gl_projection[14]=tmp.m23);
154                    o_projection.m33=(float)(o_gl_projection[15]=tmp.m33);
155                    o_frustum.setValue(tmp, i_w, i_h);
156            }
157          protected static void matResult2GLArray(NyARTransMatResult i_src,double[] o_gl_array)          protected static void matResult2GLArray(NyARTransMatResult i_src,double[] o_gl_array)
158          {          {
159                  o_gl_array[0 + 0 * 4] = i_src.m00;                  o_gl_array[0 + 0 * 4] = i_src.m00;
# Line 208  class NyARPsgBaseClass Line 172  class NyARPsgBaseClass
172                  o_gl_array[3 + 1 * 4] = 0.0;                  o_gl_array[3 + 1 * 4] = 0.0;
173                  o_gl_array[3 + 2 * 4] = 0.0;                  o_gl_array[3 + 2 * 4] = 0.0;
174                  o_gl_array[3 + 3 * 4] = 1.0;                  o_gl_array[3 + 3 * 4] = 1.0;
                 if (view_scale_factor != 0.0) {  
                         o_gl_array[12] *= view_scale_factor;  
                         o_gl_array[13] *= view_scale_factor;  
                         o_gl_array[14] *= view_scale_factor;  
                 }  
175          }          }
 }  
   
 /**  
  * 単一マーカ認識ユースケースのベースクラス。同時に一つの座標変換行列を提供します。  
  * 座標変換行列の管理関数とプロパティ機能を提供します。  
  * @author nyatla  
  *  
  */  
 class SingleMarkerBaseClass extends NyARPsgBaseClass  
 {  
         /**  
          * マーカのx,y,zの傾き角度です。  
          * <br/>EN:  
          * The angle value in radian unit of "x,y,z" .  
          */  
         public PVector angle;  
176          /**          /**
177           * マーカのx,y,zの平行移動量です。           * 左手系変換用の行列
          * <br/>EN:  
          * The translation value in radian unit of "x,y,z".  
178           */           */
179          public PVector trans;          private final static PMatrix3D _lh_mat=new PMatrix3D(-1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);
180          /**          
          * 検出したマーカの4隅の2次元画像上の位置です。  
          * <br/>EN:  
          * The position of 4 corner of marker.  
          */  
         public int[][] pos2d;  
         /**  
          * 検出したマーカの変換行列です。  
          * <br/>EN:  
          * The transform matrix of detected marker.  
          */  
         public double[] transmat;  
181          /**          /**
182           * 座標変換を実行したMatrixを準備します。           * 変換行列をProcessingのMatrixへ変換します。
183           * この関数を実行すると、processingの座標系がマーカ表面に設定されます。           * @param i_src
184           * 描画終了後には、必ずendTransform関数を呼び出して座標系を戻してください。           * @param i_mode
185           * <br/>EN:           * @param o_pmatrix
          * This function sets corresponding transform matrix to the surface of the marker to OpenGL.  
          * The coordinate system of processing moves to the surface of the marker when this function is executed.  
          * Must return the coordinate system by using endTransform function at the end.  
          * @param i_pgl  
          * PGraphicsOpenGLインスタンスを設定します。processingのgメンバをキャストして設定してください。  
          * <br/>EN:  
          * Specify PGraphicsOpenGL instance.  
          * Set cast "g" member of processing graphics object.  
186           */           */
187          public void beginTransform(PGraphicsOpenGL i_pgl)          protected static void matResult2PMatrix3D(NyARTransMatResult i_src,int i_mode,PMatrix3D o_pmatrix)
188          {          {
189                  if(this._gl!=null){                  o_pmatrix.m00 = (float)i_src.m00;
190                          this._pa.die("The function beginTransform is already called.", null);                                    o_pmatrix.m01 = (float)i_src.m01;
191                    o_pmatrix.m02 = (float)i_src.m02;
192                    o_pmatrix.m03 = (float)i_src.m03;
193                    o_pmatrix.m10 = (float)i_src.m10;//mirror
194                    o_pmatrix.m11 = (float)i_src.m11;//mirror
195                    o_pmatrix.m12 = (float)i_src.m12;//mirror
196                    o_pmatrix.m13 = (float)i_src.m13;//mirror
197                    o_pmatrix.m20 = (float)-i_src.m20;
198                    o_pmatrix.m21 = (float)-i_src.m21;
199                    o_pmatrix.m22 = (float)-i_src.m22;
200                    o_pmatrix.m23 = (float)-i_src.m23;
201                    o_pmatrix.m30 = 0.0f;
202                    o_pmatrix.m31 = 0.0f;
203                    o_pmatrix.m32 = 0.0f;
204                    o_pmatrix.m33 = 1.0f;
205                    if(i_mode==MultiARTookitMarker.CS_LEFT_HAND)
206                    {
207                            o_pmatrix.apply(_lh_mat);
208                  }                  }
209                  this._pgl=i_pgl;          }      
                 this._gl=this._pgl.beginGL();  
   
                   
                 this._gl=i_pgl.gl;  
                 this._gl.glMatrixMode(GL.GL_PROJECTION);  
                 this._pa.pushMatrix();  
                 this._pa.resetMatrix();  
                 //PGraphicsOpenGLのupdateProjectionのモノマネをします。  
                 this._gl.glLoadMatrixd(this.projection,0);  
                 this._old_matrix=this._pgl.projection;  
                 this._pgl.projection=this._ps_projection;  
   
   
                 this._gl.glMatrixMode(GL.GL_MODELVIEW);  
                 this._pa.pushMatrix();  
                 this._pa.resetMatrix();  
                 this._gl.glLoadMatrixd(this.transmat,0);  
                                   
                 this._pa.pushMatrix();  
                 return;  
         }  
210          /**          /**
211           * beginTransformによる座標変換を解除して元に戻します。           * この関数は、スクリーン座標を撮像点座標に変換します。
212           * <br/>EN:           * 撮像点の座標系は、カメラ座標系になります。
213           * This function recover coordinate system that was changed by beginTransform function.           * <p>公式 -
214             * この関数は、gluUnprojectのビューポートとモデルビュー行列を固定したものです。
215             * 公式は、以下の物使用しました。
216             * http://www.opengl.org/sdk/docs/man/xhtml/gluUnProject.xml
217             * ARToolKitの座標系に合せて計算するため、OpenGLのunProjectとはix,iyの与え方が違います。画面上の座標をそのまま与えてください。
218             * </p>
219             * @param ix
220             * スクリーン上の座標
221             * @param iy
222             * 画像上の座標
223             * @param o_point_on_screen
224             * 撮像点座標
225           */           */
226          public void endTransform()  /*      public final PVector unProject(double ix,double iy)
227          {          {
228                  if(this._gl==null){                  double n=(this._frustum_rh.m23/(this._frustum_rh.m22-1));
229                          this._pa.die("The function beginTransform is never called.", null);                                      NyARDoubleMatrix44 m44=this._inv_frustum_rh;
230                  }                  double v1=(this._screen_size.w-ix-1)*2/this._screen_size.w-1.0;//ARToolKitのFrustramに合せてる。
231                  this._pgl.projection=this._old_matrix;                  double v2=(this._screen_size.h-iy-1)*2/this._screen_size.h-1.0;
232                  this._pa.popMatrix();                  double v3=2*n-1.0;
233                  this._pa.popMatrix();                  double b=1/(m44.m30*v1+m44.m31*v2+m44.m32*v3+m44.m33);
234                  this._gl.glMatrixMode(GL.GL_PROJECTION);                  o_point_on_screen.x=(m44.m00*v1+m44.m01*v2+m44.m02*v3+m44.m03)*b;
235                  this._pa.popMatrix();                  o_point_on_screen.y=(m44.m10*v1+m44.m11*v2+m44.m12*v3+m44.m13)*b;
236                  this._gl.glMatrixMode(GL.GL_MODELVIEW);                  o_point_on_screen.z=(m44.m20*v1+m44.m21*v2+m44.m22*v3+m44.m23)*b;
                 if(this._pgl!=null){  
                         this._pgl.endGL();  
                 }  
                 this._gl=null;  
                 this._pgl=null;  
237                  return;                  return;
238            }
239    */      /**
240             * この関数は、スクリーン上の点と原点を結ぶ直線と、任意姿勢の平面の交差点を、カメラの座標系で取得します。
241             * この座標は、カメラ座標系です。
242             * @param ix
243             * スクリーン上の座標
244             * @param iy
245             * スクリーン上の座標
246             * @param i_mat
247             * 平面の姿勢行列です。
248             * @param o_pos
249             * 結果を受け取るオブジェクトです。
250             */
251    /*      public final PVector unProjectOnCamera(double ix,double iy,PMatrix3D i_mat)
252            {
253                    //画面→撮像点
254                    this.unProject(ix,iy,o_pos);
255                    //撮像点→カメラ座標系
256                    double nx=i_mat.m02;
257                    double ny=i_mat.m12;
258                    double nz=i_mat.m22;
259                    double mx=i_mat.m03;
260                    double my=i_mat.m13;
261                    double mz=i_mat.m23;
262                    double t=(nx*mx+ny*my+nz*mz)/(nx*o_pos.x+ny*o_pos.y+nz*o_pos.z);
263                    o_pos.x=t*o_pos.x;
264                    o_pos.y=t*o_pos.y;
265                    o_pos.z=t*o_pos.z;
266          }                }      
267          protected void updateTransmat(NyARSquare i_square,NyARTransMatResult i_src)  */      /**
268             * 画面上の点と原点を結ぶ直線と任意姿勢の平面の交差点を、平面の座標系で取得します。
269             * ARToolKitの本P175周辺の実装と同じです。
270             * @param ix
271             * スクリーン上の座標
272             * @param iy
273             * スクリーン上の座標
274             * @param i_mat
275             * 平面の姿勢行列です。
276             * @param o_pos
277             * 結果を受け取るオブジェクトです。
278             * @return
279             * 計算に成功すると、trueを返します。
280             */
281    /*      public final PVector unProjectOnMatrix(double ix,double iy,PMatrix3D i_mat)
282          {          {
283                  matResult2GLArray(i_src,this.transmat);                  //交点をカメラ座標系で計算
284                  //angle                  unProjectOnCamera(ix,iy,i_mat,o_pos);
285                  i_src.getZXYAngle(this._tmp_d3p);                  //座標系の変換
286                                    NyARDoubleMatrix44 m=new NyARDoubleMatrix44();
287                  this.angle.x=(float)this._tmp_d3p.x;                  if(!m.inverse(i_mat)){
288                  this.angle.y=(float)this._tmp_d3p.y;                          return false;
289                  this.angle.z=(float)this._tmp_d3p.z;                  }
290                  //trans                  m.transform3d(o_pos, o_pos);
291                  this.trans.x=(float)i_src.m03;                  return true;
                 this.trans.y=(float)i_src.m13;  
                 this.trans.z=(float)i_src.m23;  
   
                 //pos反映  
                 final NyARDoublePoint2d[] pts=i_square.sqvertex;  
                 for(int i=0;i<4;i++){  
                         this.pos2d[i][0]=(int)pts[i].x;  
                         this.pos2d[i][1]=(int)pts[i].y;  
                 }                
                   
                 return;  
292          }          }
293          /********  */      /**
294           *      protected/private           * カメラ座標系の点を、スクリーン座標の点へ変換します。
295           *******/           * @param i_x
296          private final NyARDoublePoint3d _tmp_d3p=new NyARDoublePoint3d();           * カメラ座標系の点
297                     * @param i_y
298                     * カメラ座標系の点
299          //キャッシュたち           * @param i_z
300          private GL _gl=null;           * カメラ座標系の点
301          private PGraphicsOpenGL _pgl=null;                 * @param o_pos2d
302          private PMatrix3D _old_matrix;           * 結果を受け取るオブジェクトです。
303          protected SingleMarkerBaseClass(PApplet parent,String i_cparam_file, int i_width,int i_htight,int i_projection_coord_system)           */
304    /*      public final PVector project(double i_x,double i_y,double i_z)
305          {          {
306                  super(parent,i_cparam_file,i_width,i_htight,i_projection_coord_system);                  NyARDoubleMatrix44 m=this._frustum_rh;
307                    double v3_1=1/i_z*m.m32;
308                    double w=this._screen_size.w;
309                    double h=this._screen_size.h;
310                    o_pos2d.x=w-(1+(i_x*m.m00+i_z*m.m02)*v3_1)*w/2;
311                    o_pos2d.y=h-(1+(i_y*m.m11+i_z*m.m12)*v3_1)*h/2;
312                    return;
313          }          }
314    */}
315    
   
           
           
           
           
 }  

Legend:
Removed from v.420  
changed lines
  Added in v.814

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26