Beispiel #1
0
 def __init__(self, glyph, centered=True, **kwargs):
     self.glyph = glyph
     if centered:
         L, B, R, T = self.glyph.bounds
         x = L + (R - L) / 2
         y = B + (T - B) / 2
         kwargs['translate'] = {'x': -x, 'y': -y}
     Shape.__init__(self, **kwargs)
     self.updatePath()
Beispiel #2
0
 def __init__(self,
              width=1,
              height=1,
              cornerRadius=0.25,
              closed=False,
              **kwargs):
     self.width = width if width is not None else 1
     self.height = height if height is not None else 1
     self.cornerRadius = cornerRadius
     self.closed = closed
     Shape.__init__(self, **kwargs)
Beispiel #3
0
 def __init__(self,
              diameter=1,
              width=None,
              height=None,
              quarters=4,
              closed=False,
              **kwargs):
     self.diameter = diameter
     self.width = width
     self.height = height
     self.quarters = quarters
     self.closed = closed
     Shape.__init__(self, **kwargs)
Beispiel #4
0
    def __init__(self, diameter=1, length=1, frontFace=True, backFace=True, fill=True, **kwargs):

        Shape.__init__(self, **kwargs)

        self.diameter  = diameter
        self.length    = length
        self.frontFace = frontFace
        self.backFace  = backFace
        self.fill      = fill

        self.group = CylinderGroup(addTo=self) # visible=self.visible, color=self.color

        baseZ     = self.length / 2
        baseColor = self.backface # if self.backface else True

        groupOptions = {
            'addTo'    : self.group,
            'diameter' : self.diameter,
            'color'    : self.color,
            'stroke'   : self.stroke,
            'fill'     : self.fill,
            'visible'  : self.visible
        }

        # front outside base
        self.group.frontBase = Ellipse(
            translate={ 'z': baseZ },
            rotate={ 'y': TAU / 2 },
            backface=self.frontFace, # || baseColor,
            **groupOptions)

        # back outside base
        self.group.rearBase = Ellipse(
            translate={ 'z': -baseZ },
            rotate={ 'y': 0 },
            backface=baseColor,
            **groupOptions)
Beispiel #5
0
 def __init__(self, width=None, height=None, **kwargs):
     self.width = width if width is not None else 1
     self.height = height if height is not None else 1
     Shape.__init__(self, **kwargs)
Beispiel #6
0
 def __init__(self, sides=3, radius=0.5, **kwargs):
     self.sides = sides
     self.radius = radius
     Shape.__init__(self, **kwargs)