コード例 #1
0
 def __init__(self, func=None, nx=10, ny=10, extraVars=()):
     self.function = ParametrizedFunction(func, extraVars)
     if self.function.argCount() < 2:
         raise (TypeError, "function %s needs at least 2 arguments" % func)
     self.vectorFieldFunc = None
     self.coordinates = SoCoordinate3()
     self.mesh = make_hideable(SoQuadMesh())
     self.mesh.verticesPerColumn = nx
     self.mesh.verticesPerRow = ny
     normal_binding = SoNormalBinding()
     normal_binding.value = SoNormalBinding.PER_VERTEX_INDEXED
     ## ============================
     self.scale = SoScale()
     self.lineSetX = make_hideable(SoLineSet(), show=False)
     self.lineSetY = make_hideable(SoLineSet(), show=False)
     self.linesetYcoor = SoCoordinate3()
     self.lineColor = SoMaterial()
     self.lineColor.diffuseColor = (1, 0, 0)
     ## ============================
     self.root = SoSeparator()
     self.root.addChild(normal_binding)
     self.root.addChild(self.scale)
     self.root.addChild(self.coordinates)
     self.root.addChild(self.mesh.root)
     self.root.addChild(self.lineColor)
     self.root.addChild(self.lineSetX.root)
     self.root.addChild(self.linesetYcoor)
     self.root.addChild(self.lineSetY.root)
コード例 #2
0
ファイル: base.py プロジェクト: jonntd/superficie
 def __init__(self, func=None, nx=10, ny=10, extraVars=()):
     self.function = ParametrizedFunction(func, extraVars)
     if self.function.argCount() < 2:
         raise (TypeError, "function %s needs at least 2 arguments" % func)
     self.vectorFieldFunc = None
     self.coordinates = SoCoordinate3()
     self.mesh = make_hideable(SoQuadMesh())
     self.mesh.verticesPerColumn = nx
     self.mesh.verticesPerRow = ny
     normal_binding = SoNormalBinding()
     normal_binding.value = SoNormalBinding.PER_VERTEX_INDEXED
     ## ============================
     self.scale = SoScale()
     self.lineSetX = make_hideable(SoLineSet(), show=False)
     self.lineSetY = make_hideable(SoLineSet(), show=False)
     self.linesetYcoor = SoCoordinate3()
     self.lineColor = SoMaterial()
     self.lineColor.diffuseColor = (1, 0, 0)
     ## ============================
     self.root = SoSeparator()
     self.root.addChild(normal_binding)
     self.root.addChild(self.scale)
     self.root.addChild(self.coordinates)
     self.root.addChild(self.mesh.root)
     self.root.addChild(self.lineColor)
     self.root.addChild(self.lineSetX.root)
     self.root.addChild(self.linesetYcoor)
     self.root.addChild(self.lineSetY.root)
コード例 #3
0
    def test_make_hideable(self):
        group = SoGroup()
        util.make_hideable(group)

        self.assertTrue(hasattr(group,'parent_switch'))
        self.assertEqual(list(group.parent_switch.getChildren()),[group])