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

Method testSphereIndexing

test/IECoreScene/MeshPrimitive.py:421–451  ·  view source on GitHub ↗
( self )

Source from the content-addressed store, hash-verified

419 self.assertEqual( m["myString"].indices, IECore.IntVectorData( [ 1, 0, 2, 1, 0, 2, 1, 0 ] ) )
420
421 def testSphereIndexing( self ) :
422
423 m = IECoreScene.MeshPrimitive.createSphere( radius = 1, divisions = imath.V2i( 3, 6 ) )
424 self.assertTrue( m.arePrimitiveVariablesValid() )
425
426 # We expect 18 faces. A row of 6 triangles at each cap, and a row of 6 quads
427 # in the middle.
428
429 self.assertEqual(
430 m.variableSize( IECoreScene.PrimitiveVariable.Interpolation.Uniform ),
431 18
432 )
433
434 self.assertEqual( m.verticesPerFace.count( 3 ), 12 )
435 self.assertEqual( m.verticesPerFace.count( 4 ), 6 )
436
437 # We expect 14 vertices. Two rings of 6 in the middle, and one
438 # for each of the poles.
439
440 self.assertEqual( len( m["P"].data ), 14 )
441 self.assertEqual(
442 m.variableSize( IECoreScene.PrimitiveVariable.Interpolation.Vertex ),
443 14
444 )
445
446 # UVs are slightly different because there's a seam.
447 # We expect 6 uvs at each pole (for different values of u),
448 # and 7 for each ring in between.
449
450 self.assertEqual( m["uv"].interpolation, IECoreScene.PrimitiveVariable.Interpolation.FaceVarying )
451 self.assertEqual( len( m["uv"].data ), 6 * 2 + 7 * 2 )
452
453 def testDefaultCornersAndCreases( self ) :
454

Callers

nothing calls this directly

Calls 4

createSphereMethod · 0.80
lenFunction · 0.50
variableSizeMethod · 0.45

Tested by

no test coverage detected