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

Method Ortho

Common/Transforms/vtkPerspectiveTransform.cxx:250–265  ·  view source on GitHub ↗

------------------------------------------------------------------------------ The orthographic perspective maps [xmin,xmax], [ymin,ymax], [-znear,-zfar] to [-1,+1], [-1,+1], [-1,+1]. From the OpenGL Programmer's guide, 2nd Ed.

Source from the content-addressed store, hash-verified

248// to [-1,+1], [-1,+1], [-1,+1].
249// From the OpenGL Programmer's guide, 2nd Ed.
250void vtkPerspectiveTransform::Ortho(
251 double xmin, double xmax, double ymin, double ymax, double znear, double zfar)
252{
253 double matrix[4][4];
254 vtkMatrix4x4::Identity(*matrix);
255
256 matrix[0][0] = 2 / (xmax - xmin);
257 matrix[1][1] = 2 / (ymax - ymin);
258 matrix[2][2] = -2 / (zfar - znear);
259
260 matrix[0][3] = -(xmin + xmax) / (xmax - xmin);
261 matrix[1][3] = -(ymin + ymax) / (ymax - ymin);
262 matrix[2][3] = -(znear + zfar) / (zfar - znear);
263
264 this->Concatenate(*matrix);
265}
266
267//------------------------------------------------------------------------------
268// The frustum perspective maps a frustum with the front plane at -znear

Callers 1

Calls 2

ConcatenateMethod · 0.95
IdentityFunction · 0.70

Tested by

no test coverage detected