| 1 |
nyatla |
420 |
/* |
| 2 |
|
|
* PROJECT: NyARToolkit for proce55ing. |
| 3 |
|
|
* -------------------------------------------------------------------------------- |
| 4 |
|
|
* The MIT License |
| 5 |
|
|
* Copyright (c) 2008 nyatla |
| 6 |
|
|
* airmail(at)ebony.plala.or.jp |
| 7 |
|
|
* http://nyatla.jp/nyartoolkit/ |
| 8 |
|
|
* |
| 9 |
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
| 10 |
|
|
* of this software and associated documentation files (the "Software"), to deal |
| 11 |
|
|
* in the Software without restriction, including without limitation the rights |
| 12 |
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 13 |
|
|
* copies of the Software, and to permit persons to whom the Software is |
| 14 |
|
|
* furnished to do so, subject to the following conditions: |
| 15 |
|
|
* The above copyright notice and this permission notice shall be included in |
| 16 |
|
|
* all copies or substantial portions of the Software. |
| 17 |
|
|
* |
| 18 |
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 |
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 |
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 21 |
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 |
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 23 |
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 24 |
|
|
* THE SOFTWARE. |
| 25 |
|
|
* |
| 26 |
|
|
*/ |
| 27 |
|
|
|
| 28 |
|
|
package jp.nyatla.nyar4psg; |
| 29 |
|
|
|
| 30 |
nyatla |
814 |
|
| 31 |
nyatla |
820 |
import javax.media.opengl.GL; |
| 32 |
|
|
|
| 33 |
nyatla |
420 |
import processing.core.*; |
| 34 |
nyatla |
820 |
import processing.opengl.PGraphicsOpenGL; |
| 35 |
nyatla |
420 |
|
| 36 |
|
|
import jp.nyatla.nyartoolkit.*; |
| 37 |
|
|
import jp.nyatla.nyartoolkit.core.param.*; |
| 38 |
nyatla |
814 |
import jp.nyatla.nyartoolkit.core.transmat.*; |
| 39 |
|
|
import jp.nyatla.nyartoolkit.core.types.matrix.NyARDoubleMatrix44; |
| 40 |
nyatla |
420 |
|
| 41 |
|
|
|
| 42 |
nyatla |
820 |
|
| 43 |
nyatla |
420 |
/** |
| 44 |
nyatla |
814 |
* ���������������������NyARToolkit for Processing������������������������������ |
| 45 |
|
|
* ARToolkit��������������������������������������������������������������������������������������������� |
| 46 |
nyatla |
420 |
*/ |
| 47 |
|
|
class NyARPsgBaseClass |
| 48 |
|
|
{ |
| 49 |
|
|
/** |
| 50 |
nyatla |
814 |
* ��������������������������������������������������������������������� |
| 51 |
|
|
* RightHand��������������������������������� |
| 52 |
nyatla |
820 |
* RightHand���������������ARToolKit������������������������������������������Processing������������������������������������������text��������������������������������������� |
| 53 |
nyatla |
420 |
*/ |
| 54 |
nyatla |
814 |
public final static int CS_RIGHT_HAND=0; |
| 55 |
nyatla |
420 |
/** |
| 56 |
nyatla |
814 |
* ��������������������������������������������������������������������� |
| 57 |
|
|
* LeftHand������������������������������ |
| 58 |
|
|
* RightHand���������������ARToolKit������������������������������������������Processing������������������������������������������ |
| 59 |
|
|
* processing������������������������������������������������������������������������ |
| 60 |
nyatla |
420 |
*/ |
| 61 |
nyatla |
814 |
public final static int CS_LEFT_HAND =1; |
| 62 |
nyatla |
420 |
/** |
| 63 |
|
|
* ��������������������������������� |
| 64 |
nyatla |
814 |
* NyAR4psg������������������������������������������ |
| 65 |
nyatla |
420 |
*/ |
| 66 |
nyatla |
820 |
public final static String VERSION = "NyAR4psg/0.5.1;NyARToolkit for java/3.0.0+;ARToolKit/2.72.1"; |
| 67 |
|
|
/**���Processing���������������ProjectionMatrix���������*/ |
| 68 |
nyatla |
420 |
protected PMatrix3D _ps_projection=new PMatrix3D(); |
| 69 |
nyatla |
820 |
/**���������������Applet������������������������������*/ |
| 70 |
|
|
protected PApplet _ref_papplet; |
| 71 |
|
|
/**���ARToolkit���������������������������������������������*/ |
| 72 |
nyatla |
420 |
protected NyARParam _ar_param; |
| 73 |
nyatla |
814 |
protected NyARFrustum _frustum; |
| 74 |
|
|
protected int _coord_system; |
| 75 |
nyatla |
820 |
/** |
| 76 |
|
|
* ������������������������������ |
| 77 |
|
|
*/ |
| 78 |
|
|
protected NyARPsgBaseClass() |
| 79 |
nyatla |
420 |
{ |
| 80 |
nyatla |
820 |
} |
| 81 |
|
|
protected void initInstance(PApplet parent,String i_cparam_file, int i_width,int i_height,int i_coord_system) |
| 82 |
|
|
{ |
| 83 |
nyatla |
814 |
checkCoordinateSystemRange(parent,i_coord_system); |
| 84 |
|
|
this._ref_papplet=parent; |
| 85 |
|
|
this._coord_system=i_coord_system; |
| 86 |
nyatla |
420 |
try{ |
| 87 |
nyatla |
814 |
this._frustum=new NyARFrustum(); |
| 88 |
nyatla |
420 |
this._ar_param=new NyARParam(); |
| 89 |
nyatla |
814 |
this._ar_param.loadARParam(this._ref_papplet.createInput(i_cparam_file)); |
| 90 |
|
|
this._ar_param.changeScreenSize(i_width, i_height); |
| 91 |
|
|
|
| 92 |
|
|
//Processing���projectionMatrix���������������Frustum��������� |
| 93 |
nyatla |
820 |
arPerspectiveMat2Projection(this._ar_param.getPerspectiveProjectionMatrix(),i_width,i_height,this._ps_projection,this._frustum); |
| 94 |
nyatla |
420 |
}catch(NyARException e){ |
| 95 |
nyatla |
814 |
this._ref_papplet.die("Error while setting up NyARToolkit for java", e); |
| 96 |
nyatla |
420 |
} |
| 97 |
nyatla |
820 |
return; |
| 98 |
nyatla |
420 |
} |
| 99 |
nyatla |
814 |
private final static double view_distance_min = 100; |
| 100 |
|
|
private final static double view_distance_max = 100000; |
| 101 |
nyatla |
420 |
private final static void checkCoordinateSystemRange(PApplet i_pa,int i_cs) |
| 102 |
|
|
{ |
| 103 |
|
|
switch(i_cs){ |
| 104 |
nyatla |
814 |
case NyARPsgBaseClass.CS_LEFT_HAND: |
| 105 |
|
|
case NyARPsgBaseClass.CS_RIGHT_HAND: |
| 106 |
nyatla |
420 |
return; |
| 107 |
|
|
default: |
| 108 |
nyatla |
814 |
i_pa.die("Please set constant CS_LEFT_HAND or CS_RIGHT_HAND."); |
| 109 |
nyatla |
420 |
} |
| 110 |
|
|
} |
| 111 |
nyatla |
820 |
|
| 112 |
|
|
private float[] _tmpf=new float[16]; |
| 113 |
|
|
|
| 114 |
|
|
/** |
| 115 |
|
|
* ������������������ARToolKit���������ProjectionMatrix���Processing������������������������ |
| 116 |
|
|
* ���������������������������Processing���ProjectionMatrix���ARToolKit��������������������������������������������������������������������������������������������������������������������� |
| 117 |
|
|
* Processing������������������Frustum���������������������{@link PGraphics3D#perspective()}������������������ |
| 118 |
|
|
* Frustum���������������������������{@link PGraphics3D#perspective()}���{@link PGraphics3D#perspective()}��������������������������������� |
| 119 |
|
|
* @return |
| 120 |
|
|
* ���������������������������projectionMatrix������������������ |
| 121 |
|
|
*/ |
| 122 |
|
|
public PMatrix3D setARPerspective() |
| 123 |
nyatla |
814 |
{ |
| 124 |
nyatla |
820 |
return this.setPerspective(this._ps_projection); |
| 125 |
|
|
} |
| 126 |
|
|
/** |
| 127 |
|
|
* ������������������ProjectionMatrix���Processing������������������������ |
| 128 |
|
|
* @param i_projection |
| 129 |
|
|
* ������������ProjectionMatrix��������������������� |
| 130 |
|
|
* @return |
| 131 |
|
|
* ���������������������������projectionMatrix������������������ |
| 132 |
|
|
*/ |
| 133 |
|
|
public PMatrix3D setPerspective(PMatrix3D i_projection) |
| 134 |
|
|
{ |
| 135 |
|
|
if(!(this._ref_papplet.g instanceof PGraphicsOpenGL)){ |
| 136 |
|
|
this._ref_papplet.die("NyAR4Psg require PGraphicsOpenGL instance."); |
| 137 |
|
|
} |
| 138 |
|
|
PGraphics3D g=(PGraphics3D)this._ref_papplet.g; |
| 139 |
|
|
//���������ProjectionMatrix������������������ |
| 140 |
|
|
PMatrix3D ret=new PMatrix3D(); |
| 141 |
|
|
ret.set(g.projection); |
| 142 |
|
|
//ProjectionMatrix��������� |
| 143 |
|
|
g.projection.set(i_projection); |
| 144 |
|
|
if(this._ref_papplet.g instanceof PGraphicsOpenGL) |
| 145 |
|
|
{ |
| 146 |
|
|
GL gl=((PGraphicsOpenGL)g).gl; |
| 147 |
|
|
gl.glMatrixMode(GL.GL_PROJECTION); |
| 148 |
|
|
PMatrix2GLProjection(i_projection,_tmpf); |
| 149 |
|
|
gl.glLoadMatrixf(_tmpf,0); |
| 150 |
|
|
} |
| 151 |
|
|
return ret; |
| 152 |
|
|
} |
| 153 |
|
|
|
| 154 |
|
|
protected static void PMatrix2GLProjection(PMatrix3D i_in,float[] o_out) |
| 155 |
|
|
{ |
| 156 |
|
|
o_out[ 0]=i_in.m00; |
| 157 |
|
|
o_out[ 1]=i_in.m10; |
| 158 |
|
|
o_out[ 2]=i_in.m20; |
| 159 |
|
|
o_out[ 3]=i_in.m30; |
| 160 |
|
|
o_out[ 4]=i_in.m01; |
| 161 |
|
|
o_out[ 5]=i_in.m11; |
| 162 |
|
|
o_out[ 6]=i_in.m21; |
| 163 |
|
|
o_out[ 7]=i_in.m31; |
| 164 |
|
|
o_out[ 8]=i_in.m02; |
| 165 |
|
|
o_out[ 9]=i_in.m12; |
| 166 |
|
|
o_out[10]=i_in.m22; |
| 167 |
|
|
o_out[11]=i_in.m32; |
| 168 |
|
|
o_out[12]=i_in.m03; |
| 169 |
|
|
o_out[13]=i_in.m13; |
| 170 |
|
|
o_out[14]=i_in.m23; |
| 171 |
|
|
o_out[15]=i_in.m33; |
| 172 |
|
|
} |
| 173 |
|
|
protected static void PMatrix2GLProjection(PMatrix3D i_in,double[] o_out) |
| 174 |
|
|
{ |
| 175 |
|
|
o_out[ 0]=i_in.m00; |
| 176 |
|
|
o_out[ 1]=i_in.m10; |
| 177 |
|
|
o_out[ 2]=i_in.m20; |
| 178 |
|
|
o_out[ 3]=i_in.m30; |
| 179 |
|
|
o_out[ 4]=i_in.m01; |
| 180 |
|
|
o_out[ 5]=i_in.m11; |
| 181 |
|
|
o_out[ 6]=i_in.m21; |
| 182 |
|
|
o_out[ 7]=i_in.m31; |
| 183 |
|
|
o_out[ 8]=i_in.m02; |
| 184 |
|
|
o_out[ 9]=i_in.m12; |
| 185 |
|
|
o_out[10]=i_in.m22; |
| 186 |
|
|
o_out[11]=i_in.m32; |
| 187 |
|
|
o_out[12]=i_in.m03; |
| 188 |
|
|
o_out[13]=i_in.m13; |
| 189 |
|
|
o_out[14]=i_in.m23; |
| 190 |
|
|
o_out[15]=i_in.m33; |
| 191 |
|
|
} |
| 192 |
|
|
|
| 193 |
|
|
private static void arPerspectiveMat2Projection(NyARPerspectiveProjectionMatrix i_prjmat,int i_w,int i_h,PMatrix3D o_projection,NyARFrustum o_frustum) |
| 194 |
|
|
{ |
| 195 |
nyatla |
814 |
NyARDoubleMatrix44 tmp=new NyARDoubleMatrix44(); |
| 196 |
|
|
i_prjmat.makeCameraFrustumRH(i_w, i_h, view_distance_min, view_distance_max,tmp); |
| 197 |
nyatla |
820 |
o_projection.m00=(float)(tmp.m00); |
| 198 |
|
|
o_projection.m01=(float)(tmp.m01); |
| 199 |
|
|
o_projection.m02=(float)(tmp.m02); |
| 200 |
|
|
o_projection.m03=(float)(tmp.m03); |
| 201 |
|
|
o_projection.m10=(float)(tmp.m10); |
| 202 |
|
|
o_projection.m11=(float)(tmp.m11); |
| 203 |
|
|
o_projection.m12=(float)(tmp.m12); |
| 204 |
|
|
o_projection.m13=(float)(tmp.m13); |
| 205 |
|
|
o_projection.m20=(float)(tmp.m20); |
| 206 |
|
|
o_projection.m21=(float)(tmp.m21); |
| 207 |
|
|
o_projection.m22=(float)(tmp.m22); |
| 208 |
|
|
o_projection.m23=(float)(tmp.m23); |
| 209 |
|
|
o_projection.m30=(float)(tmp.m30); |
| 210 |
|
|
o_projection.m31=(float)(tmp.m31); |
| 211 |
|
|
o_projection.m32=(float)(tmp.m32); |
| 212 |
|
|
o_projection.m33=(float)(tmp.m33); |
| 213 |
nyatla |
814 |
o_frustum.setValue(tmp, i_w, i_h); |
| 214 |
|
|
} |
| 215 |
nyatla |
420 |
protected static void matResult2GLArray(NyARTransMatResult i_src,double[] o_gl_array) |
| 216 |
|
|
{ |
| 217 |
|
|
o_gl_array[0 + 0 * 4] = i_src.m00; |
| 218 |
|
|
o_gl_array[0 + 1 * 4] = i_src.m01; |
| 219 |
|
|
o_gl_array[0 + 2 * 4] = i_src.m02; |
| 220 |
|
|
o_gl_array[0 + 3 * 4] = i_src.m03; |
| 221 |
|
|
o_gl_array[1 + 0 * 4] = -i_src.m10; |
| 222 |
|
|
o_gl_array[1 + 1 * 4] = -i_src.m11; |
| 223 |
|
|
o_gl_array[1 + 2 * 4] = -i_src.m12; |
| 224 |
|
|
o_gl_array[1 + 3 * 4] = -i_src.m13; |
| 225 |
|
|
o_gl_array[2 + 0 * 4] = -i_src.m20; |
| 226 |
|
|
o_gl_array[2 + 1 * 4] = -i_src.m21; |
| 227 |
|
|
o_gl_array[2 + 2 * 4] = -i_src.m22; |
| 228 |
|
|
o_gl_array[2 + 3 * 4] = -i_src.m23; |
| 229 |
|
|
o_gl_array[3 + 0 * 4] = 0.0; |
| 230 |
|
|
o_gl_array[3 + 1 * 4] = 0.0; |
| 231 |
|
|
o_gl_array[3 + 2 * 4] = 0.0; |
| 232 |
|
|
o_gl_array[3 + 3 * 4] = 1.0; |
| 233 |
|
|
} |
| 234 |
|
|
/** |
| 235 |
nyatla |
814 |
* ��������������������������� |
| 236 |
nyatla |
420 |
*/ |
| 237 |
nyatla |
814 |
private final static PMatrix3D _lh_mat=new PMatrix3D(-1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1); |
| 238 |
|
|
|
| 239 |
nyatla |
420 |
/** |
| 240 |
nyatla |
814 |
* ���������������Processing���Matrix��������������������� |
| 241 |
|
|
* @param i_src |
| 242 |
|
|
* @param i_mode |
| 243 |
|
|
* @param o_pmatrix |
| 244 |
nyatla |
420 |
*/ |
| 245 |
nyatla |
814 |
protected static void matResult2PMatrix3D(NyARTransMatResult i_src,int i_mode,PMatrix3D o_pmatrix) |
| 246 |
|
|
{ |
| 247 |
|
|
o_pmatrix.m00 = (float)i_src.m00; |
| 248 |
|
|
o_pmatrix.m01 = (float)i_src.m01; |
| 249 |
|
|
o_pmatrix.m02 = (float)i_src.m02; |
| 250 |
|
|
o_pmatrix.m03 = (float)i_src.m03; |
| 251 |
|
|
o_pmatrix.m10 = (float)i_src.m10;//mirror |
| 252 |
|
|
o_pmatrix.m11 = (float)i_src.m11;//mirror |
| 253 |
|
|
o_pmatrix.m12 = (float)i_src.m12;//mirror |
| 254 |
|
|
o_pmatrix.m13 = (float)i_src.m13;//mirror |
| 255 |
|
|
o_pmatrix.m20 = (float)-i_src.m20; |
| 256 |
|
|
o_pmatrix.m21 = (float)-i_src.m21; |
| 257 |
|
|
o_pmatrix.m22 = (float)-i_src.m22; |
| 258 |
|
|
o_pmatrix.m23 = (float)-i_src.m23; |
| 259 |
|
|
o_pmatrix.m30 = 0.0f; |
| 260 |
|
|
o_pmatrix.m31 = 0.0f; |
| 261 |
|
|
o_pmatrix.m32 = 0.0f; |
| 262 |
|
|
o_pmatrix.m33 = 1.0f; |
| 263 |
|
|
if(i_mode==MultiARTookitMarker.CS_LEFT_HAND) |
| 264 |
|
|
{ |
| 265 |
|
|
o_pmatrix.apply(_lh_mat); |
| 266 |
|
|
} |
| 267 |
|
|
} |
| 268 |
nyatla |
420 |
/** |
| 269 |
nyatla |
814 |
* ������������������������������������������������������������������������������ |
| 270 |
|
|
* ��������������������������������������������������������������� |
| 271 |
|
|
* <p>������ - |
| 272 |
|
|
* ������������������gluUnproject������������������������������������������������������������������������������ |
| 273 |
|
|
* ��������������������������������������������� |
| 274 |
|
|
* http://www.opengl.org/sdk/docs/man/xhtml/gluUnProject.xml |
| 275 |
|
|
* ARToolKit���������������������������������������������OpenGL���unProject������ix,iy��������������������������������������������������������������������������������������� |
| 276 |
|
|
* </p> |
| 277 |
|
|
* @param ix |
| 278 |
|
|
* ��������������������������� |
| 279 |
|
|
* @param iy |
| 280 |
|
|
* ������������������ |
| 281 |
|
|
* @param o_point_on_screen |
| 282 |
|
|
* ��������������� |
| 283 |
nyatla |
420 |
*/ |
| 284 |
nyatla |
814 |
/* public final PVector unProject(double ix,double iy) |
| 285 |
|
|
{ |
| 286 |
|
|
double n=(this._frustum_rh.m23/(this._frustum_rh.m22-1)); |
| 287 |
|
|
NyARDoubleMatrix44 m44=this._inv_frustum_rh; |
| 288 |
|
|
double v1=(this._screen_size.w-ix-1)*2/this._screen_size.w-1.0;//ARToolKit���Frustram������������������ |
| 289 |
|
|
double v2=(this._screen_size.h-iy-1)*2/this._screen_size.h-1.0; |
| 290 |
|
|
double v3=2*n-1.0; |
| 291 |
|
|
double b=1/(m44.m30*v1+m44.m31*v2+m44.m32*v3+m44.m33); |
| 292 |
|
|
o_point_on_screen.x=(m44.m00*v1+m44.m01*v2+m44.m02*v3+m44.m03)*b; |
| 293 |
|
|
o_point_on_screen.y=(m44.m10*v1+m44.m11*v2+m44.m12*v3+m44.m13)*b; |
| 294 |
|
|
o_point_on_screen.z=(m44.m20*v1+m44.m21*v2+m44.m22*v3+m44.m23)*b; |
| 295 |
|
|
return; |
| 296 |
|
|
} |
| 297 |
|
|
*/ /** |
| 298 |
|
|
* ��������������������������������������������������������������������������������������������������������������������������������������������������������� |
| 299 |
|
|
* ��������������������������������������������� |
| 300 |
|
|
* @param ix |
| 301 |
|
|
* ��������������������������� |
| 302 |
|
|
* @param iy |
| 303 |
|
|
* ��������������������������� |
| 304 |
|
|
* @param i_mat |
| 305 |
|
|
* ������������������������������ |
| 306 |
|
|
* @param o_pos |
| 307 |
|
|
* ������������������������������������������������ |
| 308 |
nyatla |
420 |
*/ |
| 309 |
nyatla |
814 |
/* public final PVector unProjectOnCamera(double ix,double iy,PMatrix3D i_mat) |
| 310 |
|
|
{ |
| 311 |
|
|
//������������������ |
| 312 |
|
|
this.unProject(ix,iy,o_pos); |
| 313 |
|
|
//������������������������������ |
| 314 |
|
|
double nx=i_mat.m02; |
| 315 |
|
|
double ny=i_mat.m12; |
| 316 |
|
|
double nz=i_mat.m22; |
| 317 |
|
|
double mx=i_mat.m03; |
| 318 |
|
|
double my=i_mat.m13; |
| 319 |
|
|
double mz=i_mat.m23; |
| 320 |
|
|
double t=(nx*mx+ny*my+nz*mz)/(nx*o_pos.x+ny*o_pos.y+nz*o_pos.z); |
| 321 |
|
|
o_pos.x=t*o_pos.x; |
| 322 |
|
|
o_pos.y=t*o_pos.y; |
| 323 |
|
|
o_pos.z=t*o_pos.z; |
| 324 |
|
|
} |
| 325 |
|
|
*/ /** |
| 326 |
|
|
* ������������������������������������������������������������������������������������������������������������������������ |
| 327 |
|
|
* ARToolKit������P175��������������������������������� |
| 328 |
|
|
* @param ix |
| 329 |
|
|
* ��������������������������� |
| 330 |
|
|
* @param iy |
| 331 |
|
|
* ��������������������������� |
| 332 |
|
|
* @param i_mat |
| 333 |
|
|
* ������������������������������ |
| 334 |
|
|
* @param o_pos |
| 335 |
|
|
* ������������������������������������������������ |
| 336 |
|
|
* @return |
| 337 |
|
|
* ���������������������������true������������������ |
| 338 |
nyatla |
420 |
*/ |
| 339 |
nyatla |
814 |
/* public final PVector unProjectOnMatrix(double ix,double iy,PMatrix3D i_mat) |
| 340 |
nyatla |
420 |
{ |
| 341 |
nyatla |
814 |
//������������������������������������ |
| 342 |
|
|
unProjectOnCamera(ix,iy,i_mat,o_pos); |
| 343 |
|
|
//������������������ |
| 344 |
|
|
NyARDoubleMatrix44 m=new NyARDoubleMatrix44(); |
| 345 |
|
|
if(!m.inverse(i_mat)){ |
| 346 |
|
|
return false; |
| 347 |
nyatla |
420 |
} |
| 348 |
nyatla |
814 |
m.transform3d(o_pos, o_pos); |
| 349 |
|
|
return true; |
| 350 |
nyatla |
420 |
} |
| 351 |
nyatla |
814 |
*/ /** |
| 352 |
|
|
* ������������������������������������������������������������������������������ |
| 353 |
|
|
* @param i_x |
| 354 |
|
|
* ������������������������ |
| 355 |
|
|
* @param i_y |
| 356 |
|
|
* ������������������������ |
| 357 |
|
|
* @param i_z |
| 358 |
|
|
* ������������������������ |
| 359 |
|
|
* @param o_pos2d |
| 360 |
|
|
* ������������������������������������������������ |
| 361 |
nyatla |
420 |
*/ |
| 362 |
nyatla |
814 |
/* public final PVector project(double i_x,double i_y,double i_z) |
| 363 |
nyatla |
420 |
{ |
| 364 |
nyatla |
814 |
NyARDoubleMatrix44 m=this._frustum_rh; |
| 365 |
|
|
double v3_1=1/i_z*m.m32; |
| 366 |
|
|
double w=this._screen_size.w; |
| 367 |
|
|
double h=this._screen_size.h; |
| 368 |
|
|
o_pos2d.x=w-(1+(i_x*m.m00+i_z*m.m02)*v3_1)*w/2; |
| 369 |
|
|
o_pos2d.y=h-(1+(i_y*m.m11+i_z*m.m12)*v3_1)*h/2; |
| 370 |
nyatla |
420 |
return; |
| 371 |
|
|
} |
| 372 |
nyatla |
814 |
*/} |
| 373 |
nyatla |
420 |
|