ATAN2 and HYPOT functions for ints...

Eychaner, Glenn C. gceych at juliet.caltech.edu
Tue Dec 18 12:46:44 AEST 1990


Ok, so here's my problem.
I am dividing two 512x512 arrays of unsigned char into 8x8 boxes, summing over
the boxes, and then shoving the results from the two arrays through atan2() 
and hypot().  The problem is: these function are awfully slow, as I have to
convert int (the result of the summing) to float, and then convert the result
back to int (unsigned char, actually).  Anyone got a faster way to do this?
No, LUTs, BTW, the "summing" has some added complications I won't mention which
increases the range of the numbers involved...
In other words, anyone got a hypot() or atan2() function which take and return
int?  (Note: atan2 should return a number in degrees if it returns int...)
                                                      Just wondering...
                                                      Glenn
Glenn Eychaner   |Eychaner at SunCub.Caltech.edu |Remember: It is easier to ride a
40386 N Shore Ln |gceych at iago.caltech.edu     |camel through the eye of a needle
Big Bear City, CA| Big Bear Solar Observatory |than to drive a Buick through the
            92314| !*** G O  N I N E R S ***! |hole in a doughnut.



More information about the Comp.lang.c mailing list