MCPcopy Create free account
hub / github.com/ImageEngine/cortex / fitWindow

Method fitWindow

src/IECoreScene/Camera.cpp:289–318  ·  view source on GitHub ↗

pxr/imaging/lib/cameraUtil/conformWindow.cpp : CameraUtilConformedWindow

Source from the content-addressed store, hash-verified

287
288//pxr/imaging/lib/cameraUtil/conformWindow.cpp : CameraUtilConformedWindow
289Imath::Box2f Camera::fitWindow( const Imath::Box2f &window, Camera::FilmFit fitMode, float targetAspect)
290{
291 if( fitMode == Camera::Distort )
292 {
293 return window; // Just return the original window, even if this produces non-square pixels
294 }
295
296 const Camera::FilmFit resolvedFitMode =
297 resolveFitMode( window.size(), fitMode, targetAspect);
298
299 if( resolvedFitMode == Camera::Horizontal )
300 {
301 const double height =
302 window.size()[0] / (targetAspect != 0.0 ? targetAspect : 1.0);
303
304 return Imath::Box2f(
305 Imath::V2f( window.min[0], window.center()[1] - 0.5f * height ),
306 Imath::V2f( window.max[0], window.center()[1] + 0.5f * height )
307 );
308 }
309 else
310 {
311 const double width = window.size()[1] * targetAspect;
312
313 return Imath::Box2f(
314 Imath::V2f(window.center()[0] - 0.5f * width, window.min[1]),
315 Imath::V2f(window.center()[0] + 0.5f * width, window.max[1])
316 );
317 }
318}
319
320Imath::Box2f Camera::frustum() const
321{

Callers 1

testFitWindowMethod · 0.80

Calls 2

resolveFitModeFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected