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

Method testCameraParameters

test/IECoreScene/Camera.py:76–108  ·  view source on GitHub ↗
( self )

Source from the content-addressed store, hash-verified

74 self.assertEqual( ccc, c )
75
76 def testCameraParameters( self ) :
77
78 c = IECoreScene.Camera()
79
80 # Defaults
81 self.assertEqual( c.getProjection(), "orthographic" )
82 self.assertEqual( c.getAperture(), imath.V2f( 2, 2 ) )
83 self.assertEqual( c.getApertureOffset(), imath.V2f( 0, 0 ) )
84 self.assertEqual( c.getFocalLength(), 1 )
85 self.assertEqual( c.getClippingPlanes(), imath.V2f( 0.01, 100000 ) )
86 self.assertEqual( c.getFStop(), 0 )
87 self.assertAlmostEqual( c.getFocalLengthWorldScale(), 0.1 )
88 self.assertEqual( c.getFocusDistance(), 1 )
89
90 # Set some values
91 c.setProjection("perspective" )
92 c.setAperture(imath.V2f( 36, 24 ) )
93 c.setApertureOffset(imath.V2f( 1, -1 ) )
94 c.setFocalLength( 35 )
95 c.setClippingPlanes(imath.V2f( -10, 42 ) )
96 c.setFStop( 3.0 )
97 c.setFocalLengthWorldScale( 0.001 )
98 c.setFocusDistance( 12.0 )
99
100 # Test that we've got the new values
101 self.assertEqual( c.getProjection(), "perspective" )
102 self.assertEqual( c.getAperture(), imath.V2f( 36, 24 ) )
103 self.assertEqual( c.getApertureOffset(), imath.V2f( 1, -1 ) )
104 self.assertEqual( c.getFocalLength(), 35 )
105 self.assertEqual( c.getClippingPlanes(), imath.V2f( -10, 42 ) )
106 self.assertEqual( c.getFStop(), 3.0 )
107 self.assertAlmostEqual( c.getFocalLengthWorldScale(), 0.001 )
108 self.assertEqual( c.getFocusDistance(), 12.0 )
109
110 def testDefaultApertureFromObseleteFovAndScreenWindow( self ) :
111

Callers

nothing calls this directly

Calls 2

setClippingPlanesMethod · 0.95
CameraMethod · 0.45

Tested by

no test coverage detected