Forum: Poser - OFFICIAL


Subject: Bagginsbill's Sketchbook

bagginsbill opened this issue on Jul 30, 2012 · 130 posts


bagginsbill posted Thu, 02 August 2012 at 11:40 PM

The code.

 

def pfRoundRect(xs, zs, r):
        hxs = xs * .5
        hzs = zs * .5
        def f(t):
                qt = t % 1.25
                if qt <= 1:
                        v = Vector(hxs+r, 0, hzs - zs * qt)
                else:
                        v = Vector(r, 0, 0) >> YRot(360 * (qt - 1)) >> Trans(hxs, 0, -hzs)
                q = floor(t / 1.25)
                v << YRot(90 * q)
                return v
        return f

def splineTransform1(f, t):
        dt = .001
        tp = t + dt / 2
        tn = t - dt / 2
        p = f(t)
        dp = (f(tp) - f(tn)) * (1.0 / dt)
        tx = MatrixFromVector(dp)
        tx.w = p
        return tx

f = pfRoundRect(3 * feet, 3 * feet, 3 * inch)

pl = PolyList()
shape = ucircleSOUTH(3 * inch, 36) >> Scale(.5, 1, 1) 
pa = None
for t in lerps(0, 25, 300 * 8):
        tx = splineTransform1(f, t) * Trans(0, t * feet / 5, 0)
        tx = Scale((30 - t) / 30) * <br></br>                      Scale(1 + .5 * sin(2 * 2 * pi * 5 * ((t/5) ** 2) / 1.25)) * <br></br>                      Trans(-3 * inch, 0, 0) * tx
        pb = shape >> tx
        if pa:
                pl << pb.bridge(pa)
        pa = pb
pl.weld()
loadPL(pl)

Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)