[vox-tech] Success with fltk and SDL_image

Micah J. Cowan vox-tech@lists.lugod.org
Wed, 12 May 2004 21:06:12 -0700


On Wed, May 12, 2004 at 06:42:34PM -0700, Peter Jay Salzman wrote:
> On Wed 12 May 04,  1:47 PM, Bill Kendrick <nbs@sonic.net> said:
> > On Wed, May 12, 2004 at 01:36:23PM -0700, Peter Jay Salzman wrote:
> > > Even for pi/2 rotations, it takes a little trig.   :-)
> > 
> > Hrm?
> > 
> > Nah!
> > 
> > for (y = height - 1; y >= 0; y--)
> > {
> >   for (x = width - 1; x >= 0; x++)
> >   {
> >     src_x = width - x - 1;
> >     src_y = height - y - 1;
> > 
> >     ... copy pixel from src surface @ (src_x,src_y) to
> >         dest surface @ (x,y)
> >   }
> > }
> > 
> > ;^)
> > 
> > Or am I totally confused?
>  
> not confused.  most people don't think about math too deeply.
> 
> every rotation by pi/2, no matter what algorithm you use, is a special
> case of a more general method of rotation.

So you're saying the trig is implied. I don't think I buy that. I
would consider them two methods to arrive at the same answer. That you
will get 1 and 0 from the "trig" method merely validates the answer
obtained from the other method. Math often has several ways to arrive
at the same conclusion. To use one method does not mean that you
implicitly used another; the multiple methods merely validate one
another. In both math and CS I frequently will solve a problem more
than once, using different methods/theories behind the methods, to
verify that I am receiving the correct answer.

I would consider the above algorithm to be one based on simple
geometric observation. The fact that it "works from trig's point of
view, too" doesn't mean that trig was involved. Trig merely provides
another explanation of /why/ it works.

-- 
Micah J. Cowan
micah@cowan.name