------------------------------------------------------------------------------ The Shear method can be used after Perspective to create correct perspective views for use with head-tracked stereo on a flat, fixed (i.e. not head-mounted) viewing screen. You must measure the eye position relative to the center of the RenderWindow (or the center of the screen, if the window is full-screen). The foll
| 360 | // tried any of this except for with pencil & paper. Looks good on |
| 361 | // paper, though! |
| 362 | void vtkPerspectiveTransform::Shear(double dxdz, double dydz, double zplane) |
| 363 | { |
| 364 | double matrix[4][4]; |
| 365 | vtkMatrix4x4::Identity(*matrix); |
| 366 | |
| 367 | // everything is negative because the position->focalpoint vector |
| 368 | // is in the -z direction, hence z distances along that vector |
| 369 | // are negative. |
| 370 | |
| 371 | // shear according to the eye position relative to the screen |
| 372 | matrix[0][2] = -dxdz; |
| 373 | matrix[1][2] = -dydz; |
| 374 | |
| 375 | // shift so that view rays converge in the focal plane |
| 376 | matrix[0][3] = -zplane * dxdz; |
| 377 | matrix[1][3] = -zplane * dydz; |
| 378 | |
| 379 | // concatenate with the current matrix |
| 380 | this->Concatenate(*matrix); |
| 381 | } |
| 382 | |
| 383 | //------------------------------------------------------------------------------ |
| 384 | // For convenience -- this is sufficient for most people's stereo needs. |
no test coverage detected