Mail Archives: djgpp/1997/03/31/13:21:51
> Is there any way to "smooth" an object, which movees with the sin and
> cos functions?
> I use float variables to calculate next position, and then i add them to
> float variables, which i then translate to integer variables.
> (integer_var = (int) float_var)
> But when the ball moves across the screen, I can see this "jumping
> around".
> It isn't steady.
There are several aspects to smooth appearance of movement.
sin and cos are not necessarily the right remedy here.
First you should check if the calculated positions of the
object you want to move are in the same order of granularity than your
device resolution. That is,from one postition to another should only
be a few pixels difference.
The next point is that you may need a double buffering technique
for having smooth appearance.
sin and cos can come into play when you need a certain law of motion,
e.g. sinusoidal or movement one a circle path. I'd geuss you'd
better be off for a jumping ball with a parabolic law of movement
( s = a * t^2 )
> How can I "smooth" it?
> Should I somehow calculate a center position between two calculated
> points?
Given the said above it would be appropriate to calculate more
intermediate points.
>
> Thanks for your answers.
>
>
--
Christoph P. U. Kukulies kuku AT gil DOT physik DOT rwth-aachen DOT de
- Raw text -