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

Method testSphere

test/IECoreScene/MeshNormalsOpTest.py:74–97  ·  view source on GitHub ↗
( self )

Source from the content-addressed store, hash-verified

72 self.assertEqual( pp, p )
73
74 def testSphere( self ) :
75
76 s = IECore.Reader.create( os.path.join( "test", "IECore", "data", "cobFiles", "pSphereShape1.cob" ) ).read()
77 del s["N"]
78 self.assertTrue( not "N" in s )
79
80 ss = IECoreScene.MeshNormalsOp()( input=s )
81
82 self.assertTrue( "N" in ss )
83 self.assertEqual( ss["N"].interpolation, IECoreScene.PrimitiveVariable.Interpolation.Vertex )
84
85 normals = ss["N"].data
86 self.assertTrue( normals.isInstanceOf( IECore.V3fVectorData.staticTypeId() ) )
87 self.assertEqual( normals.size(), ss.variableSize( IECoreScene.PrimitiveVariable.Interpolation.Vertex ) )
88 self.assertEqual( normals.getInterpretation(), IECore.GeometricData.Interpretation.Normal )
89
90 points = ss["P"].data
91 for i in range( 0, normals.size() ) :
92
93 self.assertTrue( math.fabs( normals[i].length() - 1 ) < 0.001 )
94
95 p = points[i].normalize()
96 self.assertTrue( normals[i].dot( p ) > 0.99 )
97 self.assertTrue( normals[i].dot( p ) < 1.01 )
98
99 def testUniformInterpolation( self ) :
100

Callers

nothing calls this directly

Calls 8

joinMethod · 0.80
MeshNormalsOpMethod · 0.80
isInstanceOfMethod · 0.80
staticTypeIdMethod · 0.80
readMethod · 0.45
createMethod · 0.45
sizeMethod · 0.45
variableSizeMethod · 0.45

Tested by

no test coverage detected