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

Method GetProjectionTransformMatrix

Rendering/Core/vtkCamera.cxx:1153–1179  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Return the projection transform matrix. See ComputeProjectionTransform.

Source from the content-addressed store, hash-verified

1151//------------------------------------------------------------------------------
1152// Return the projection transform matrix. See ComputeProjectionTransform.
1153vtkMatrix4x4* vtkCamera::GetProjectionTransformMatrix(vtkRenderer* ren)
1154{
1155 double aspect[2];
1156 int lowerLeft[2];
1157 int usize, vsize;
1158 vtkMatrix4x4* matrix = vtkMatrix4x4::New();
1159
1160 ren->GetTiledSizeAndOrigin(&usize, &vsize, lowerLeft, lowerLeft + 1);
1161
1162 // some renderer subclasses may have more complicated computations for the
1163 // aspect ratio. So take that into account by computing the difference
1164 // between our simple aspect ratio and what the actual renderer is reporting.
1165 ren->ComputeAspect();
1166 ren->GetAspect(aspect);
1167 double aspect2[2];
1168 ren->vtkViewport::ComputeAspect();
1169 ren->vtkViewport::GetAspect(aspect2);
1170 double aspectModification = aspect[0] * aspect2[1] / (aspect[1] * aspect2[0]);
1171
1172 if (usize && vsize)
1173 {
1174 matrix->DeepCopy(this->GetProjectionTransformMatrix(aspectModification * usize / vsize, -1, 1));
1175 matrix->Transpose();
1176 }
1177
1178 return matrix;
1179}
1180
1181//------------------------------------------------------------------------------
1182// Return the projection transform matrix. See ComputeProjectionTransform.

Callers 15

GetKeyMatricesMethod · 0.45
RenderMethod · 0.45
UpdatePolygonCoordsMethod · 0.45
ComputeMatricesMethod · 0.45
TransformPointsMethod · 0.45
GetMinimumBoundsDepthMethod · 0.45
GetMinimumBoundsDepthMethod · 0.45
vtkRenderer.cxxFile · 0.45
UpdateCameraMVPBufferMethod · 0.45

Calls 7

ComputeAspectMethod · 0.80
NewFunction · 0.70
GetTiledSizeAndOriginMethod · 0.45
DeepCopyMethod · 0.45
TransposeMethod · 0.45
GetMatrixMethod · 0.45

Tested by

no test coverage detected