HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
conformWindow.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_IMAGING_CAMERA_UTIL_CONFORM_WINDOW_H
8 #define PXR_IMAGING_CAMERA_UTIL_CONFORM_WINDOW_H
9 
10 #include "pxr/pxr.h"
12 
14 
15 class GfVec2d;
16 class GfVec4d;
17 class GfMatrix4d;
18 class GfRange2d;
19 class GfCamera;
20 class GfFrustum;
21 
22 /// \enum CameraUtilConformWindowPolicy
23 ///
24 /// Policy of how to conform a window to the given aspect ratio.
25 /// An ASCII-art explanation is given in the corresponding .cpp file.
26 ///
28  /// Modify width
30  /// Modify height
32  /// Increase width or height
34  /// Decrease width or height
36  /// Leave unchanged (This can result in stretching/shrinking if not pre-fit)
38 };
39 
40 /// Returns a window with aspect ratio \p targetAspect by applying
41 /// \p policy to \p window where \p window is encoded as GfRange2d.
45  const GfRange2d &window,
46  CameraUtilConformWindowPolicy policy, double targetAspect);
47 
48 /// Returns a window with aspect ratio \p targetAspect by applying
49 /// \p policy to \p window where \p window is encoded as vector
50 /// (left, right, bottom, top) similarly to RenderMan's RiScreenWindow.
52 GfVec4d
54  const GfVec4d &window,
55  CameraUtilConformWindowPolicy policy, double targetAspect);
56 
57 /// Returns a window with aspect ratio \p targetAspect by applying
58 /// \p policy to \p window where \p window is encoded as vector
59 /// (width, height).
61 GfVec2d
63  const GfVec2d &window,
64  CameraUtilConformWindowPolicy policy, double targetAspect);
65 
66 /// Conforms the given \p projectionMatrix to have aspect ratio \p targetAspect
67 /// by applying \p policy.
68 ///
69 /// Note that this function also supports mirroring about the x- or y-axis of
70 /// the image corresponding to flipping all signs in the second, respectively,
71 /// third column of the projection matrix. In other words, we get the same
72 /// result whether we flip the signs in the matrix and then give it to this
73 /// function or call this function first and flip the signs of the resulting
74 /// matrix.
78  const GfMatrix4d &projectionMatrix,
79  CameraUtilConformWindowPolicy policy, double targetAspect);
80 
81 /// Conforms the given \p camera to have aspect ratio \p targetAspect
82 /// by applying \p policy.
84 void
86  GfCamera *camera,
87  CameraUtilConformWindowPolicy policy, double targetAspect);
88 
89 /// Conforms the given \p frustum to have aspect ratio \p targetAspect
90 /// by applying \p policy.
92 void
94  GfFrustum *frustum,
95  CameraUtilConformWindowPolicy policy, double targetAspect);
96 
97 
99 
100 #endif
hboost::math::policies::policy< hboost::math::policies::domain_error< hboost::math::policies::ignore_error >, hboost::math::policies::pole_error< hboost::math::policies::ignore_error >, hboost::math::policies::overflow_error< hboost::math::policies::ignore_error >, hboost::math::policies::underflow_error< hboost::math::policies::ignore_error >, hboost::math::policies::denorm_error< hboost::math::policies::ignore_error >, hboost::math::policies::rounding_error< hboost::math::policies::ignore_error >, hboost::math::policies::evaluation_error< hboost::math::policies::ignore_error >, hboost::math::policies::indeterminate_result_error< hboost::math::policies::ignore_error > > policy
Definition: SYS_MathCbrt.h:35
Object-based representation of a camera.
Definition: camera.h:32
CAMERAUTIL_API void CameraUtilConformWindow(GfCamera *camera, CameraUtilConformWindowPolicy policy, double targetAspect)
Definition: vec4d.h:45
Definition: vec2d.h:45
Decrease width or height.
Definition: conformWindow.h:35
CameraUtilConformWindowPolicy
Definition: conformWindow.h:27
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
Leave unchanged (This can result in stretching/shrinking if not pre-fit)
Definition: conformWindow.h:37
#define CAMERAUTIL_API
Definition: api.h:23
CAMERAUTIL_API GfRange2d CameraUtilConformedWindow(const GfRange2d &window, CameraUtilConformWindowPolicy policy, double targetAspect)
Increase width or height.
Definition: conformWindow.h:33