POV-Ray : Newsgroups : povray.off-topic : Still random : Re: FIXED! Server Time
29 Sep 2024 17:18:20 EDT (-0400)
  Re: FIXED!  
From: scott
Date: 10 May 2009 05:30:05
Message: <4a069e9d@news.povray.org>
> The only problem is that *now* you can't say
>
>   p1 = p0 * dt v0
>
> without sprinkling it with typecasts.
>
> Actually, what you'd *probably* do is define
>
>   step :: TimeStep -> Velocity -> Position
>   step dt (Velocity v) = Position (dt * v)
>
> and then have
>
>   p1 = p0 + step dt v0

Couldn't you just define a * function that takes a velocity and a time and 
returns a position?  You can do the same for one that takes an acceleration 
and a time and returns velocity.  Then you wouldn't need to change the code, 
and * looks better than "step".

In fact, maybe it's possible to do all this automatically if you keep track 
of the units somehow?  Could you do this in Haskell?  Somehow tell it that 
distance is units L, velocity is units L*T, etc, and then it would work it 
all out automatically when you did multiplication and division.  Would be 
pretty cool for phyical simulations.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.