From: Christoph Kukulies Message-Id: <199703311804.UAA14416@gilberto.physik.RWTH-Aachen.DE> Subject: Re: SIN and COS In-Reply-To: <333F687F.6EF4@geocities.com> from Henri Ossi at "Mar 31, 97 10:32:15 am" To: henriossi AT geocities DOT com (Henri Ossi) Date: Mon, 31 Mar 1997 20:04:13 +0200 (MET DST) Cc: djgpp AT delorie DOT com Reply-To: Christoph Kukulies MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit > 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