Exemplo n.º 1
0
def cylinder(image,
             coord,
             extent,
             radius,
             color,
             shadow=False,
             finish=None,
             blob=None):
    # coord is the center of one end, with the center of the other end
    # in the direction determined by extent.  blob can be True or a
    # blob strength.
    import povray as pr
    x = _format_appearance(color, finish)
    finish, pigment, interior = x
    if blob is True:
        blob = 1.0

    w = image.handle.write
    coord1 = _coord2pr(image, coord)
    x, y, z = coord1
    width, height, depth = extent
    coord2 = x + width, y - height, z - depth
    name = image._make_object_name()
    ns = None
    if not shadow:
        ns = pr.no_shadow()
    w(
        pr.declare(
            name,
            pr.cylinder(
                pr.vector(*coord1),
                pr.vector(*coord2),
                radius,
                pigment,
                finish,
                interior,
                ns,
            )))
    w(pr.object_(name))

    # HACK: min_extent and max_extent doesn't work for blobs for some
    # reason.  Solution is to draw the object so that the extent can
    # be calculated, and then draw a blob at the same place.
    if blob:
        w(
            pr._fmt_complex(
                "blob",
                pr.blob_threshold(0.01),
                pr.blob_cylinder(pr.vector(*coord1), pr.vector(*coord2),
                                 radius, blob),
                pigment,
                finish,
                interior,
                ns,
            ))
    w("\n")
def pillar(x,y,z,height):
    return pv.cylinder([x,y,z],[x,y+height,z],5,"Black")
def burner(x,y,z):
    return pv.cylinder([x,y,z],
                       [x,y+burnerheight,z],
                       burnerdiameter/2,"Silver"),
def house(x,y,z):
    return pv.cylinder([x,y,z],[x,y+2,z],10,"Silver")