------------------------------------------------------------------------------ Return the projection transform matrix. See ComputeProjectionTransform.
| 1151 | //------------------------------------------------------------------------------ |
| 1152 | // Return the projection transform matrix. See ComputeProjectionTransform. |
| 1153 | vtkMatrix4x4* 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. |
no test coverage detected