[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Need the formulas to calculated the Magnetude & Direction
Don't know if anyone already answered this, but I think I've posted
this here before -- perhaps it's worth repeating... (you can also find
this info in Werner's FFPG)...
Basically:
c2m(x,y) = sqrt(x*x + y*y)
and
c2d(x,y) = atan2(y,x) * 512 / pi
where the factor 512/pi is used to scale the angle in radians as
returned by atan2 to the integer range [-512, 512) expected by FF.
Note that FF uses precomputed tables to speed up these calculations;
the result is only an approximation, but is never off by more than +/- 1.
Cheers,
-Alex
----------
> From: Martijn W. van der Lee <mwvdlee@open.net>
> To: Thomas de Massy <tomasd@axess.com>; FFDG <ff@aurdev.com>
> Subject: RE: Need the formulas to calculated the Magnetude & Direction
> Date: Monday, March 08, 1999 9:00 AM
>
> > Hi,
> > I'm working on a C++ program, and I badly need the math formulas
> > to calculate the magnetude & the direction of an image.
>
> Do you mean some functions corresponding to the FF c2d and c2m functions?
>
> regards,
> Martijn.