PDA

View Full Version : Exponential Scaling


Wenamun
01-19-2006, 01:19 PM
Hi.
My code scales my model (ball for now) with coordinates from my PPT system.
I would like to be able to scale the model quickly with very little movement from the PPT. Right now it's a one to one ratio.
I've used ppt.command(4.002)
to scale all my numbers by 2, or 5 or ten etc.
But I want exponential growth.

Thanks for any help!

Here's my code:

viz.go()

PORT_PPT = 4

ball = viz.add('white_ball.wrl')
ball.translate(0,2,5)
ppt = viz.add('vizppt.dls')

def ontimer(num):
data = ppt.get()
ball.scale(data[0],data[1],data[2])


viz.callback(viz.TIMER_EVENT, ontimer)
viz.starttimer(1,viz.FASTEST_EXPIRATION, viz.FOREVER)


-Wenamun

tobin
01-23-2006, 09:11 PM
I'm rather unclear what you're asking for here, but if you're saying you want the size of the ball to scale exponentially with distance measurements from PPT, then you ought to replace the scale call with an exponential function of the PPT data frather than using the data directly.

Here's a good primer on exponentials:

http://mathworld.wolfram.com/ExponentialFunction.html