MCPcopy Create free account
hub / github.com/Kitware/VTK / Shear

Method Shear

Common/Transforms/vtkPerspectiveTransform.cxx:362–381  ·  view source on GitHub ↗

------------------------------------------------------------------------------ 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

Source from the content-addressed store, hash-verified

360// tried any of this except for with pencil & paper. Looks good on
361// paper, though!
362void 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.

Callers 3

StereoMethod · 0.95

Calls 2

ConcatenateMethod · 0.95
IdentityFunction · 0.70

Tested by

no test coverage detected