def solidSquare(color, widths): d = Point(0.0, 0.0, 0.0) a = d.translate(0, widths[0]) c = d.translate(1, widths[1]) b = a.translate(1, widths[1]) def render(): color.render() glBegin(GL_TRIANGLE_FAN) for point in [a, b, c, d]: point.render() glEnd() return newGLStack(widths, render)
def divider(color, dimension, length, width, capLength): widths = [0 for i in range(3)] tDimension = _dual_dimension(dimension) widths[dimension] = width widths[tDimension] = length z = Point(0.0, 0.0) a = z.translate(tDimension, capLength) b = a.translate(tDimension, length - 2 * capLength) e = a.translate(dimension, width) d = b.translate(dimension, width) f = z.translate(dimension, width / 2.0) c = f.translate(tDimension, length) def render(): color.render() glBegin(GL_TRIANGLE_FAN) for point in [a, b, c, d, e, f]: point.render() glEnd() return newGLStack(widths, render)