Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

Re: Alternative atan2 (was Motion 52: final ...)



Vincent Lefèvre replied to me:
> > In fact, I think we need to define overlapping ranges, i.e. to define
> > atan2p() to have the range [0,+2pi).  Would that work?
>
> I don't think [0,2pi) is OK.  How would you represent [-eps,+eps]?

You would use an extension of atan2() and not atan2p().  Remember that
earlier I had said:
>> I think what we need are three point functions, atan2(), atan2p() and
>> atan2m(), with respective ranges (-pi,+pi], [+pi,+3pi) and (-3pi,-pi],
>> with a rule that selects the appropriate one, based on which argument
>> contains zero (if any).  I guess [-pi,+pi]_trv would be returned if
>> both arguments contain 0.

Basically, one would define atan2_sharp(Y,X) piecemeal, based on either
atan2() or atan2p(), possibly using the case() operator.  Roughly, one
could have:
   if (both X and Y contain 0)   return [-pi,+pi]_trv
   if (X < 0)                    return atan2p(Y,X)
   else                          return atan2(Y,X)

An output of[-eps, +eps] could result from X positive and large,
and Y straddling zero and narrow.

Michel.
---Sent: 2013-12-03 05:29:21 UTC