Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
glfMatrix.cpp
1 /*
2  This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4  Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10  BIAS is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation; either version 2.1 of the License, or
13  (at your option) any later version.
14 
15  BIAS is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with BIAS; if not, write to the Free Software
22  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23  */
24 
25 #include "glfMatrix.hh"
26 #include "glfException.hh"
27 
28 using namespace BIAS;
29 
30 static inline Matrix4x4<float> ToFloat(const Matrix4x4<double>& m)
31 {
32  return Matrix4x4<float>(
33  (float)m[0][0], (float)m[0][1], (float)m[0][2], (float)m[0][3],
34  (float)m[1][0], (float)m[1][1], (float)m[1][2], (float)m[1][3],
35  (float)m[2][0], (float)m[2][1], (float)m[2][2], (float)m[2][3],
36  (float)m[3][0], (float)m[3][1], (float)m[3][2], (float)m[3][3]);
37 }
38 
39 static inline Matrix3x3<float> ToFloat(const Matrix3x3<double>& m)
40 {
41  return Matrix3x3<float>(
42  (float)m[0][0], (float)m[0][1], (float)m[0][2],
43  (float)m[1][0], (float)m[1][1], (float)m[1][2],
44  (float)m[2][0], (float)m[2][1], (float)m[2][2]);
45 }
46 
47 static inline Vector3<float> ToFloat(const Vector3<double>& v)
48 {
49  return Vector3<float>((float)v[0], (float)v[1], (float)v[2]);
50 }
51 
52 const glfMatrix glfMatrix::IDENTITY(1.0f, 0.0f, 0.0f, 0.0f,
53  0.0f, 1.0f, 0.0f, 0.0f,
54  0.0f, 0.0f, 1.0f, 0.0f,
55  0.0f, 0.0f, 0.0f, 1.0f);
56 
58 {
59 }
60 
61 glfMatrix::glfMatrix(GLfloat m0, GLfloat m1, GLfloat m2, GLfloat m3,
62  GLfloat m4, GLfloat m5, GLfloat m6, GLfloat m7,
63  GLfloat m8, GLfloat m9, GLfloat m10, GLfloat m11,
64  GLfloat m12, GLfloat m13, GLfloat m14, GLfloat m15)
65 {
66  m[0] = m0; m[4] = m4; m[ 8] = m8; m[12] = m12;
67  m[1] = m1; m[5] = m5; m[ 9] = m9; m[13] = m13;
68  m[2] = m2; m[6] = m6; m[10] = m10; m[14] = m14;
69  m[3] = m3; m[7] = m7; m[11] = m11; m[15] = m15;
70 }
71 
73 {
74  *this = IDENTITY;
75 }
76 
77 void glfMatrix::MakeRotation(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
78 {
79  // normalize (x,y,z) if length is not 1.
80  GLfloat ls = x*x + y*y + z*z;
81  if (fabs(ls - 1.0) > 0.00001) {
82  GLfloat l = sqrtf(ls);
83  GLfloat invL = 1.0 / l;
84  x *= invL;
85  y *= invL;
86  z *= invL;
87  }
88 
89  GLfloat c = cosf((angle / 180.0) * M_PI);
90  GLfloat s = sinf((angle / 180.0) * M_PI);
91  GLfloat ic = 1.0 - c;
92 
93  m[0] = x*x*ic+c; m[4] = y*x*ic-z*s; m[ 8] = x*z*ic+y*s; m[12] = 0.0;
94  m[1] = x*y*ic+z*s; m[5] = y*y*ic+c; m[ 9] = y*z*ic-x*s; m[13] = 0.0;
95  m[2] = x*z*ic-y*s; m[6] = y*z*ic+x*s; m[10] = z*z*ic+c; m[14] = 0.0;
96  m[3] = 0.0; m[7] = 0.0; m[11] = 0.0; m[15] = 1.0;
97 }
98 
99 void glfMatrix::MakeTranslation(GLfloat x, GLfloat y, GLfloat z)
100 {
101  m[0] = 1.0f; m[4] = 0.0f; m[ 8] = 0.0f; m[12] = x;
102  m[1] = 0.0f; m[5] = 1.0f; m[ 9] = 0.0f; m[13] = y;
103  m[2] = 0.0f; m[6] = 0.0f; m[10] = 1.0f; m[14] = z;
104  m[3] = 0.0f; m[7] = 0.0f; m[11] = 0.0f; m[15] = 1.0f;
105 }
106 
107 void glfMatrix::MakeScalation(GLfloat x, GLfloat y, GLfloat z)
108 {
109  m[0] = x; m[4] = 0.0; m[ 8] = 0.0; m[12] = 0.0;
110  m[1] = 0.0; m[5] = y; m[ 9] = 0.0; m[13] = 0.0;
111  m[2] = 0.0; m[6] = 0.0; m[10] = z; m[14] = 0.0;
112  m[3] = 0.0; m[7] = 0.0; m[11] = 0.0; m[15] = 1.0;
113 }
114 
115 void glfMatrix::MakeFrustum(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal)
116 {
117  GLfloat A = (right+left)/(right-left);
118  GLfloat B = (top+bottom)/(top-bottom);
119  GLfloat C = -(farVal+nearVal)/(farVal-nearVal);
120  GLfloat D = -2.0*(farVal*nearVal)/(farVal-nearVal);
121 
122  GLfloat E = 2*nearVal/(right - left);
123  GLfloat F = 2*nearVal/(top - bottom);
124 
125  m[0] = E; m[4] = 0.0; m[ 8] = A; m[12] = 0.0;
126  m[1] = 0.0; m[5] = F; m[ 9] = B; m[13] = 0.0;
127  m[2] = 0.0; m[6] = 0.0; m[10] = C; m[14] = D;
128  m[3] = 0.0; m[7] = 0.0; m[11] = -1.0; m[15] = 0.0;
129 }
130 
131 void glfMatrix::MakeOrtho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal)
132 {
133  GLfloat tx = -(right+left)/(right-left);
134  GLfloat ty = -(top+bottom)/(top-bottom);
135  GLfloat tz = -(farVal+nearVal)/(farVal-nearVal);
136 
137  GLfloat a = 2.0/(right-left);
138  GLfloat b = 2.0/(top-bottom);
139  GLfloat c = -2.0/(farVal-nearVal);
140 
141  m[0] = a; m[4] = 0.0f; m[ 8] = 0.0f; m[12] = tx;
142  m[1] = 0.0f; m[5] = b; m[ 9] = 0.0f; m[13] = ty;
143  m[2] = 0.0f; m[6] = 0.0f; m[10] = c; m[14] = tz;
144  m[3] = 0.0f; m[7] = 0.0f; m[11] = 0.0f; m[15] = 1.0f;
145 }
146 
147 void glfMatrix::MakePerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar)
148 {
149  GLfloat f = 1.0 / tan(0.5 * ((fovy / 180.0) * M_PI));
150 
151  GLfloat E = f / aspect;
152  GLfloat F = f;
153  GLfloat C = (zFar + zNear) / (zNear - zFar);
154  GLfloat D = (2.0 * zFar * zNear) / (zNear - zFar);
155 
156  m[0] = E; m[4] = 0.0f; m[ 8] = 0.0f; m[12] = 0.0f;
157  m[1] = 0.0f; m[5] = F; m[ 9] = 0.0f; m[13] = 0.0f;
158  m[2] = 0.0f; m[6] = 0.0f; m[10] = C; m[14] = D;
159  m[3] = 0.0f; m[7] = 0.0f; m[11] = -1.0f; m[15] = 0.0f;
160 }
161 
162 void glfMatrix::MakeLookAt(GLfloat eyeX, GLfloat eyeY, GLfloat eyeZ,
163  GLfloat centerX, GLfloat centerY, GLfloat centerZ,
164  GLfloat upX, GLfloat upY, GLfloat upZ)
165 {
166  Vector3<float> f(centerX - eyeX,
167  centerY - eyeY,
168  centerZ - eyeZ);
169  f.Normalize();
170 
171  Vector3<float> up(upX, upY, upZ);
172  up.Normalize();
173 
174  Vector3<float> s;
175  s = f.CrossProduct(up);
176  s.Normalize();
177 
178  Vector3<float> u;
179  u = s.CrossProduct(f);
180 
181  glfMatrix a;
182  a.m[0] = s[0]; a.m[4] = s[1]; a.m[ 8] = s[2]; a.m[12] = 0.0f;
183  a.m[1] = u[0]; a.m[5] = u[1]; a.m[ 9] = u[2]; a.m[13] = 0.0f;
184  a.m[2] = -f[0]; a.m[6] = -f[1]; a.m[10] = -f[2]; a.m[14] = 0.0f;
185  a.m[3] = 0.0f; a.m[7] = 0.0f; a.m[11] = 0.0f; a.m[15] = 1.0f;
186 
187  glfMatrix b;
188  b.MakeTranslation(-eyeX, -eyeY, -eyeZ);
189 
190  *this = a * b;
191 }
192 
194 {
195  m[0] = a[0][0]; m[4] = a[0][1]; m[ 8] = a[0][2]; m[12] = a[0][3];
196  m[1] = a[1][0]; m[5] = a[1][1]; m[ 9] = a[1][2]; m[13] = a[1][3];
197  m[2] = a[2][0]; m[6] = a[2][1]; m[10] = a[2][2]; m[14] = a[2][3];
198  m[3] = a[3][0]; m[7] = a[3][1]; m[11] = a[3][2]; m[15] = a[3][3];
199 }
200 
202 {
203  Make(ToFloat(a));
204 }
205 
207 {
208  m[0] = r[0][0]; m[4] = r[0][1]; m[ 8] = r[0][2]; m[12] = t[0];
209  m[1] = r[1][0]; m[5] = r[1][1]; m[ 9] = r[1][2]; m[13] = t[1];
210  m[2] = r[2][0]; m[6] = r[2][1]; m[10] = r[2][2]; m[14] = t[2];
211  m[3] = 0.0f; m[7] = 0.0f; m[11] = 0.0f; m[15] = 1.0f;
212 }
213 
215 {
216  MakeAffine(ToFloat(r), ToFloat(t));
217 }
218 
220 {
221  GLfloat x = a.m[12];
222  GLfloat y = a.m[13];
223  GLfloat z = a.m[14];
224 
225  m[0] = a.m[0]; m[4] = a.m[1]; m[ 8] = a.m[ 2]; m[12] = -(x*a.m[0]+y*a.m[1]+z*a.m[2]);
226  m[1] = a.m[4]; m[5] = a.m[5]; m[ 9] = a.m[ 6]; m[13] = -(x*a.m[4]+y*a.m[5]+z*a.m[6]);
227  m[2] = a.m[8]; m[6] = a.m[9]; m[10] = a.m[10]; m[14] = -(x*a.m[8]+y*a.m[9]+z*a.m[10]);
228  m[3] = 0.0f; m[7] = 0.0f; m[11] = 0.0f; m[15] = 1.0f;
229 }
230 
232 {
233  unsigned int uiWidth, uiHeight;
234  params.GetImageSize(uiWidth, uiHeight);
235  double width = static_cast<double>(uiWidth);
236  double height = static_cast<double>(uiHeight);
237 
238  KMatrix K = params.GetK();
239  BIASASSERT(K[0][1]==0.0);
240  Matrix4x4<double> embeddedK;
241  embeddedK.SetZero();
242  for(unsigned int i =0; i<3; i++) {
243  for(unsigned int j =0; j<3; j++) {
244  embeddedK[i][j] = static_cast<double>(K[i][j]);
245  }
246  }
247 
248  // embeddedK[2][2] = 0.0; //deletes z
249  embeddedK[3][2] = 1.0; //gets homogenouse 2D part also into 4th component
250 
251  embeddedK[0][0] /= width;
252  embeddedK[0][2] += 0.5;
253  embeddedK[0][2] /= width;
254 
255  embeddedK[1][1] /= height;
256  embeddedK[1][2] += 0.5;
257  embeddedK[1][2] /= height;
258 
259  if(flip) {
260  embeddedK[1][1] *= -1.0;
261  embeddedK[1][2] *= -1.0;
262  embeddedK[1][2] += 1.0;
263  }
264 
265  Matrix4x4<double> res;
266  embeddedK.Mult(params.GetPose().GetGlobalToLocalTransform(), res);
267  Make(res);
268 }
269 
270 
272 {
273  RMatrix R = params.GetR();
274  Vector3<double> C = params.GetC();
275 
276  // flip y and z axis
277  for(unsigned int i=0; i<3; i++) {
278  R[i][1] = -R[i][1];
279  R[i][2] = -R[i][2];
280  }
281 
282  Matrix4x4<double> adaptedExtrinsics(R.Transpose(),
283  (-1.0)*R.Transpose()*C);
284  Make(adaptedExtrinsics);
285 }
286 
288 {
290 }
291 
293  GLfloat nearZZ, GLfloat farZ, bool useIdealK)
294 {
295  unsigned int uiWidth, uiHeight;
296  if (useIdealK)
297  params.GetIdealImageSize(uiWidth, uiHeight);
298  else
299  params.GetImageSize(uiWidth, uiHeight);
300 
301  MakeProjectionMatrix(params, nearZZ, farZ, 0, 0,
302  uiWidth, uiHeight, useIdealK);
303 }
304 
306  GLfloat nearZ, GLfloat farZ, bool flip)
307 {
308  unsigned int width, height;
309  params.GetImageSize(width, height);
310 
311  MakeProjectionMatrixNew(params, nearZ, farZ, 0,0, width, height, false, flip);
312 }
313 
315  GLfloat nearZ, GLfloat farZ,
316  unsigned int x0, unsigned int y0,
317  unsigned int width, unsigned int height,
318  bool useIdealK, bool flip)
319 {
320  BIASASSERT(nearZ<farZ);
321  BIASASSERT(nearZ>0.0);
322 
323  KMatrix K;
324 
325  if (useIdealK) {
326  params.GetIdealK(K);
327  } else {
328  K = params.GetK();
329  }
330 
331  Matrix4x4<double> embededK;
332  embededK.SetZero();
333  for(unsigned int i=0; i<3; i++) {
334  for(unsigned int j=0; j<3; j++) {
335  embededK[i][j] = K[i][j];//
336  }
337  //embededK[i][3] = K[i][2];//principle point
338  }
339  embededK[2][2] = 1;//propagating z to new z
340  embededK[3][3] = 1;//propagating w to new w
341 
342  // std::cout<<"embededK = "<<embededK<<std::endl;
343 
344  Matrix4x4<double> normalizingK;
345  normalizingK.SetZero();
346  normalizingK[0][0] = 2.0/static_cast<double>(width); //kxx
347  normalizingK[0][2] = (1.0 - 2.0*static_cast<double>(x0))/static_cast<double>(width) - 1.0; //kxz
348  if(!flip) {
349  normalizingK[1][1] = -2.0/static_cast<double>(height); //kyy
350  normalizingK[1][2] = (2.0*static_cast<double>(y0)-1.0)/static_cast<double>(height) + 1.0; //kyz
351  } else {
352  normalizingK[1][1] = 2.0/static_cast<double>(height); //kyy
353  normalizingK[1][2] = (1.0-2.0*static_cast<double>(y0))/static_cast<double>(height) - 1.0; //kyz
354  }
355  normalizingK[2][2] = (farZ + nearZ)/(farZ - nearZ); //kzz
356  normalizingK[2][3] = -(1+normalizingK[2][2])*nearZ; //kzw
357 
358  normalizingK[3][2] = 1.0;
359 
360  // std::cout<<"normalizingK = "<<normalizingK<<std::endl;
361 
362  Matrix4x4<double> res = normalizingK*embededK;
363  Make(res);
364 }
365 
366 void
368 {
369  unsigned int width, height;
370  params.GetImageSize(width, height);
371 
372  KMatrix K;
373  K = params.GetK();
374 
375  Matrix4x4<double> embededK;
376  embededK.SetZero();
377  for(unsigned int i=0; i<3; i++) {
378  for(unsigned int j=0; j<3; j++) {
379  embededK[i][j] = K[i][j];//
380  }
381  //embededK[i][3] = K[i][2];//principle point
382  }
383  embededK[2][2] = 1;//propagating z to new z
384  embededK[3][3] = 1;//propagating w to new w
385 
386  Matrix4x4<double> normalizingK;
387  normalizingK.SetZero();
388  normalizingK[0][0] = 1.0/static_cast<double>(width); //kxx
389  normalizingK[0][2] = 1.0/(2.0*static_cast<double>(width)); //kxz
390  if(!flip) {
391  normalizingK[1][1] = 1.0/static_cast<double>(height); //kyy
392  normalizingK[1][2] = 1.0/(2.0*static_cast<double>(height)); //kyz
393  } else {
394  normalizingK[1][1] = -1.0/static_cast<double>(height); //kyy
395  normalizingK[1][2] = 1.0-1.0/(2.0*static_cast<double>(height)); //kyz
396  }
397  normalizingK[2][2] = 1.0; //kzz
398  normalizingK[2][3] = 0; //kzw
399 
400  normalizingK[3][2] = 1.0;
401 
402  Matrix4x4<double> classicP = embededK*params.GetPose().GetGlobalToLocalTransform();
403  Matrix4x4<double> res = normalizingK*classicP;
404  Make(res);
405 }
406 
408  GLfloat nearZ, GLfloat farZ,
409  unsigned int x0, unsigned int y0,
410  unsigned int width, unsigned int height,
411  bool useIdealK)
412 {
413 
414  BIASASSERT(nearZ<farZ);
415  BIASASSERT(nearZ>0.0);
416 
417  double originX = x0;
418  double originY = y0;
419 
420  if (useIdealK) {
421  KMatrix K;
422  params.GetIdealK(K);
423  params.SetK(K);
424  }
425 
426 
427 
428 // Vector2<double> clippingWindowUL, clippingWindowLR;
429  // shift by half pixel because in BIAS we assume that
430  // samples lie on half pixels
431  // need to shift by +0.5 in y, because y axis was flipped by view matrix.
432  // clippingWindowUL[0] = ((originX-0.5 - K[0][2]) / K[0][0]) * nearZ;
433 // clippingWindowUL[1] = ((originY+0.5 - K[1][2]) / K[1][1]) * nearZ;
434 // clippingWindowLR[0] = ((originX+windowWidth-0.5 - K[0][2]) / K[0][0]) * nearZ;
435 // clippingWindowLR[1] = ((originY+windowHeight+0.5 - K[1][2]) / K[1][1]) * nearZ;
436 
437  //use unprojection to find image plane
438  Vector3<double> clippingWindowUL, clippingWindowLR, p;
439  params.UnProjectLocal(HomgPoint2D(originX-0.5, originY-0.5), p, clippingWindowUL);
440  params.UnProjectLocal(HomgPoint2D(originX+width-0.5, originY+height-0.5), p, clippingWindowLR);
441  clippingWindowUL *= (nearZ/clippingWindowUL[2]);
442  clippingWindowLR *= (nearZ/clippingWindowLR[2]);
443 
444  const double left = clippingWindowUL[0];
445  const double right = clippingWindowLR[0];
446 
447  //we have to flip here ! because GL is using a projection into a
448  // LEFT HAND coordinate frame!!!!
449  //orginX, originY is the UPPER RIGHT corner of the visible region
450  //in the BIAS image coordiante frame, which is motivated by a
451  // system transforming purley RIGHT HAND coordinates.
452  // originX+width, originY+height thus is the lower right corner of the
453  // image for bias!
454  const double bottom = -clippingWindowLR[1];
455  const double top = -clippingWindowUL[1];
456 
457  double deltaX = right - left;
458  double deltaY = top - bottom;
459  double deltaZ = nearZ - farZ;
460 
461  //implementation of matrix specified in OpenGL sepcs
462  //used in glFrustum
463  Matrix4x4<double> res;
464  res.SetZero();
465  res[0][0] = 2.0*nearZ / deltaX;
466 // res[0][2] = (clippingWindowLR[0] + clippingWindowUL[0]) / deltaX;
467  res[0][2] = (right+left)/deltaX;
468 
469  res[1][1] = 2.0*nearZ / deltaY;
470 // res[1][2] = (clippingWindowLR[1] + clippingWindowUL[1]) / deltaY;
471  res[1][2] = (bottom+top)/deltaY;
472  res[2][2] = (farZ + nearZ) / (deltaZ);
473  res[2][3] = (2.0*farZ*nearZ) / (deltaZ);
474 
475  res[3][2] = -1.0;
476 
477  Make(res);
478 }
479 
481 {
482  out[0] = in[0]*m[ 0] + in[1]*m[ 4] + in[2]*m[ 8] + m[12];
483  out[1] = in[0]*m[ 1] + in[1]*m[ 5] + in[2]*m[ 9] + m[13];
484  out[2] = in[0]*m[ 2] + in[1]*m[ 6] + in[2]*m[10] + m[14];
485 
486  GLfloat invW = 1.0 / (in[0]*m[3] + in[1]*m[7] + in[2]*m[11] + m[15]);
487  out[0] *= invW;
488  out[1] *= invW;
489  out[2] *= invW;
490 }
491 
493 {
494  Vector3<float> temp;
495  TransformPoint(ToFloat(in), temp);
496  out = Vector3<double>(temp[0], temp[1], temp[2]);
497 }
498 
500 {
501  *this = *this * a;
502 }
503 
505 {
506  *this = *this * a;
507 }
508 
510 {
511  glfMatrix r;
512  for (int i = 0; i < 4; i++) {
513  for (int j = 0; j < 4; j++) {
514  GLfloat c = 0.0;
515  for (int k = 0; k < 4; k++) {
516  c += m[i+k*4] * a.m[k+j*4];
517  }
518  r.m[i+j*4] = c;
519  }
520  }
521  return r;
522 }
523 
524 unsigned int glfMatrix::Matrix2DIndexToRep(unsigned int row, unsigned int column)
525 {
526  return column*4 + row;
527 }
528 
530 {
531  for(unsigned int r=0; r<4; r++ ) {
532  vOut[r] = 0;
533  for(unsigned int c=0; c<4; c++ ) {
534  unsigned int i = Matrix2DIndexToRep(r,c);
535  vOut[r] += m[i]*vIn[c];
536  }
537  }
538 }
539 
540 void glfMatrix::Load() const
541 {
542  glLoadMatrixf(m);
543 }
virtual BIAS::Vector3< double > GetC() const
Get projection center.
glfMatrix operator*(const glfMatrix &a)
Definition: glfMatrix.cpp:509
void MakeAffine(const Matrix3x3< float > &r, const Vector3< float > &t)
Initializes the render matrix as an affine mapping.
Definition: glfMatrix.cpp:206
void MakeProjectionMatrixNew(const ProjectionParametersPerspective &params, GLfloat nearZ, GLfloat farZ, unsigned int x0, unsigned int y0, unsigned int width, unsigned int height, bool useIdealK=false, bool flip=false)
Definition: glfMatrix.cpp:314
static const glfMatrix IDENTITY
The identity matrix.
Definition: glfMatrix.hh:158
void MakeIdentity()
Definition: glfMatrix.cpp:72
void Multiply(const glfMatrix &a)
Definition: glfMatrix.cpp:499
camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
void MakeTranslation(GLfloat x, GLfloat y, GLfloat z)
Definition: glfMatrix.cpp:99
glfMatrix()
The constructor leaves the matrix undefined!
Definition: glfMatrix.cpp:57
3D rotation matrix
Definition: RMatrix.hh:49
void MakeLookAt(GLfloat eyeX, GLfloat eyeY, GLfloat eyeZ, GLfloat centerX, GLfloat centerY, GLfloat centerZ, GLfloat upX, GLfloat upY, GLfloat upZ)
Definition: glfMatrix.cpp:162
class Vector4 contains a Vector of dim.
Definition: Vector4.hh:65
void SetZero()
Sets all values to zero.
Definition: Matrix.hh:856
void CrossProduct(const Vector3< T > &argvec, Vector3< T > &destvec) const
cross product of two vectors destvec = this x argvec
Definition: Vector3.hh:594
void MakeAffineInverse(const glfMatrix &a)
Computes the inverse of the matrix, assuming it is an affine transformation with an orthonormal linea...
Definition: glfMatrix.cpp:219
void Mult(const Vector4< T > &argvec, Vector4< T > &destvec) const
matrix - vector multiplicate this matrix with Vector4, storing the result in destvec, calculates: destvec = (this Matrix) * argvec
Definition: Matrix4x4.hh:121
void MakeTextureMatrix(const ProjectionParametersPerspective &params, bool flip=false)
Conversion from ProjectionParametersPerspective.
Definition: glfMatrix.cpp:231
void MakeRotation(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
Definition: glfMatrix.cpp:77
virtual BIAS::RMatrix GetR() const
Get orientation as rotation matrix R.
void Make(const Matrix4x4< float > &a)
Initializes the glf matrix from a BIAS matrix.
Definition: glfMatrix.cpp:193
is a &#39;fixed size&#39; quadratic matrix of dim.
Definition: Matrix.hh:54
class Vector3 contains a Vector of fixed dim.
Definition: Matrix.hh:53
virtual int GetImageSize(unsigned int &Width, unsigned int &Height) const
Obtain image dimensions.
void MakeTextureMatrixNew(const ProjectionParametersPerspective &params, bool flip)
Definition: glfMatrix.cpp:367
void MakePerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar)
Definition: glfMatrix.cpp:147
static unsigned int Matrix2DIndexToRep(unsigned int row, unsigned int column)
Definition: glfMatrix.cpp:524
void TransformPoint(const Vector3< float > &in, Vector3< float > &out) const
Transforms a point by the matrix.
Definition: glfMatrix.cpp:480
Matrix3x3< T > Transpose() const
returns transposed matrix tested 12.06.2002
Definition: Matrix3x3.cpp:167
A 4x4 matrix in native OpenGL format.
Definition: glfMatrix.hh:41
K describes the mapping from world coordinates (wcs) to pixel coordinates (pcs).
Definition: KMatrix.hh:48
void MakeViewMatrixNew(const ProjectionParametersBase &params)
Definition: glfMatrix.cpp:287
void MakeProjectionMatrix(const ProjectionParametersPerspective &params, GLfloat nearZZ, GLfloat farZ, bool useIdealK=false)
Definition: glfMatrix.cpp:292
Matrix4x4< double > GetGlobalToLocalTransform() const
Get 4x4 matrix which transforms points in global coordinate system to homogeneous points in local coo...
is a &#39;fixed size&#39; quadratic matrix of dim.
Definition: Matrix4x4.hh:54
void MakeViewMatrix(const ProjectionParametersBase &params)
Definition: glfMatrix.cpp:271
void operator*=(const glfMatrix &a)
Definition: glfMatrix.cpp:504
virtual void UnProjectLocal(const HomgPoint2D &pos, Vector3< double > &pointOnRay, Vector3< double > &direction, bool IgnoreDistortion=false) const
calculates the viewing ray from the camera center (in the camera coordinate system) which belongs to ...
void GetIdealImageSize(unsigned int &width, unsigned int &height) const
void MakeFrustum(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal)
Definition: glfMatrix.cpp:115
Camera parameters which define the mapping between rays in the camera coordinate system and pixels in...
void MakeOrtho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearVal, GLfloat farVal)
Definition: glfMatrix.cpp:131
virtual const BIAS::Pose & GetPose() const
Return complete pose object.
virtual void Load() const
Loads the matrix in OpenGL.
Definition: glfMatrix.cpp:540
virtual void SetK(const KMatrix &K)
sets the internal parameters from a given KMatrix and updates the cached K and its inverse ...
Vector3< T > & Normalize()
normalize this vector to length 1
Definition: Vector3.hh:663
class BIASGeometryBase_EXPORT HomgPoint2D
void MakeScalation(GLfloat x, GLfloat y, GLfloat z)
Definition: glfMatrix.cpp:107