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

Method AdjustZBuffer

Common/Transforms/vtkPerspectiveTransform.cxx:234–244  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Utility for adjusting the min/max range of the Z buffer. Usually the oldZMin, oldZMax are [-1,+1] as per Ortho and Frustum, and you are mapping the Z buffer to a new range.

Source from the content-addressed store, hash-verified

232// the oldZMin, oldZMax are [-1,+1] as per Ortho and Frustum, and
233// you are mapping the Z buffer to a new range.
234void vtkPerspectiveTransform::AdjustZBuffer(
235 double oldZMin, double oldZMax, double newZMin, double newZMax)
236{
237 double matrix[4][4];
238 vtkMatrix4x4::Identity(*matrix);
239
240 matrix[2][2] = (newZMax - newZMin) / (oldZMax - oldZMin);
241 matrix[2][3] = (newZMin * oldZMax - newZMax * oldZMin) / (oldZMax - oldZMin);
242
243 this->Concatenate(*matrix);
244}
245
246//------------------------------------------------------------------------------
247// The orthographic perspective maps [xmin,xmax], [ymin,ymax], [-znear,-zfar]

Callers 1

Calls 2

ConcatenateMethod · 0.95
IdentityFunction · 0.70

Tested by

no test coverage detected