예제 #1
0
 def __init__(this,
              Vs,
              Cs,
              Es=[],
              Ns=[],
              colors=([], []),
              name="4DSimpleShape"):
     """
     Cs: and array of cells, consisting of an array of Fs.
     """
     if this.dbgTrace:
         print '%s.SimpleShape.__init__(%s,..):' % (this.__class__name)
     this.dimension = 4
     this.generateNormals = False
     this.v = Geom3D.Fields()
     this.e = Geom3D.Fields()
     this.f = Geom3D.Fields()
     this.c = Geom3D.Fields()
     # SETTINGS similar to Geom3D.SimpleShape:
     #print 'SimpleShape.Fs', Fs
     this.name = name
     if colors[0] == []:
         colors = ([rgb.gray95[:]], [])
     # if this.mapToSingeShape = False each cell is mapped to one 3D shape
     # and the edges are mapped to one shape as well. The disadvantage is
     # that for each shape glVertexPointer is set, while if
     # this.mapToSingeShape = True is set to True one vertex array is used.
     this.mapToSingeShape = True
     # if useTransparency = False opaque colours are used, even if they
     # specifically set to transparent colours.
     this.useTransparency(True)
     this.setVertexProperties(Vs=Vs, Ns=Ns, radius=-1., color=[1., 1., .8])
     this.setFaceProperties(colors=colors, drawFaces=True)
     this.glInitialised = False
     # SETTINGS 4D specific:
     this.setCellProperties(Cs=Cs,
                            colors=colors,
                            drawCells=False,
                            scale=1.0)
     # For initialisation setCellProperties needs to be called before
     # setEdgeProperties, since the latter will check the scale value
     this.setEdgeProperties(Es=Es,
                            radius=-1.,
                            color=[0.1, 0.1, 0.1],
                            drawEdges=True,
                            showUnscaled=True)
     this.setProjectionProperties(11.0, 10.0)
     # expresses whether the 4D coordinates need to be updated:
     this.rot4 = None
     this.projectedTo3D = False
     if this.dbgPrn:
         print '%s.__init__(%s,..)' % (this.__class__, this.name)
         print 'this.colorData:'
         for i in range(len(this.colorData[0])):
             print('%d.' % i), this.colorData[0][i]
         if len(this.colorData[0]) > 1:
             assert this.colorData[0][1] != [0]
         print this.colorData[1]