Re: New proposal for math.e
Colin Taylor wrote:
> Juergen Luethje wrote:
> >
> > Colin Taylor wrote:
> >
> > <snip>
> > >
> > > In the above functions, angle is expressed in radians, increasing in a
> > > clockwise
> > > direction from east.
> > >
> > > Regards, Colin (now returning to deep lurk mode)
> >
> > I don't know what you mean by "east" in this context. However, the
> > normal math convention is: Increasing positive values of an angle
> > correspond to _counter_ clockwise rotation.
> >
> > But I've seen now that different textbooks use different conventions
> > about the range of values that is used for the angle in Polar
> > Coordinates. Some books use -PI < a <= PI, while others use
> > 0 <= a < 2*PI. Our implementation of the functions will depend on the
> > range that we'll allow for the angle.
> >
> > Regards,
> > Juergen
>
> When I wrote these functions some years ago I wanted them to be perfectly
> reversable so that data could be transformed in both directions without
> any corruption. I think I also wanted to adopt the same angle notation
> which was used by another application (don't remember which - possibly
> AutoCAD) so that I could easily import and export data.
>
> I leave it to Juergen or someone else to recommend an angle notation which
> works best with Euphoria, and (if necessary) modify the functions to suit.
>
> Regards, Colin
Helo Colin,
in the meantime, I've looked closer to this stuff, and I think
when rect_to_polar() returns an angle between -PI and +PI, like
yours code does, this is probably the most straightforward way.
I'd like to read an opinion of a mathematician, though.
What I'd actually like to change in rect_to_polar() is the return
value for the angle, when both x and y are 0. In this case the angle
is undefined. This would be again a good case for having 'nil' or
'nan' available in Euphoria. We don't have it, but I think at least
it's better to assign 0 to the angle in this case, rather than HALF_PI.
And the docs should contain something like this:
| Note: A calling program should firstly check the
| 'distance' value of the result. If it is 0, then the
| 'angle' value of the result is actually undefined.
Regards,
Juergen
|
Not Categorized, Please Help
|
|