On Sat, 2009-01-10 at 17:13 +0100, Csaba Halász wrote:
#2 0x0080188d in FGNavRadio::update (this=0x98df490,
dt=0.058334) at src/Instrumentation/navradio.cxx:613
613 double angle = asin( y / x ) * SGD_RADIANS_TO_DEGREES;
(gdb) p x
$1 =
* Ron Jensen -- Thursday 02 April 2009:
I think we need
double angle = atan2( y, x ) * SGD_RADIANS_TO_DEGREES;
Agreed. And that's also done just a few lines later, with the
exact same parameters. Comitted, thanks! (I also re-used an
already initialized node for altitude-ft.)
m.
Since dist is calculated by using sqrt() it should never become negative. So
the line
else if (dist = -y) angle = -90.0; // against roundoff.
is probably not really needed.
That leaves the question: what happens if dist becomes zero? Apparently that
means you have hit the gs-antenna and you
#2 0x0080188d in FGNavRadio::update (this=0x98df490,
dt=0.058334) at src/Instrumentation/navradio.cxx:613
613 double angle = asin( y / x ) * SGD_RADIANS_TO_DEGREES;
(gdb) p x
$1 = 3.2580450943147174
(gdb) p y
$2 = 3.258443598627875
(gdb) p y / x
$3 =
On 01/10/2009 09:13 AM, Csaba Halász wrote:
#2 0x0080188d in FGNavRadio::update (this=0x98df490,
dt=0.058334) at src/Instrumentation/navradio.cxx:613
613 double angle = asin( y / x ) * SGD_RADIANS_TO_DEGREES;
(gdb) p x
$1 = 3.2580450943147174
(gdb) p
On Sat, Jan 10, 2009 at 5:50 PM, John Denker j...@av8n.com wrote:
On 01/10/2009 09:13 AM, Csaba Halász wrote:
#2 0x0080188d in FGNavRadio::update (this=0x98df490,
dt=0.058334) at src/Instrumentation/navradio.cxx:613
613 double angle = asin( y / x ) *
On 01/10/2009 10:22 AM, Csaba Halász wrote:
Clamping it is guaranteed 100% safe and effective.
Something like the attached patch? Not sure what to do about the x == 0 case.
How about this version? It assumes dist is not less than zero,
but is otherwise pretty defensive.
diff --git
On Sat, Jan 10, 2009 at 6:49 PM, John Denker j...@av8n.com wrote:
On 01/10/2009 10:22 AM, Csaba Halász wrote:
Clamping it is guaranteed 100% safe and effective.
Something like the attached patch? Not sure what to do about the x == 0 case.
How about this version? It assumes dist is not less
On 01/10/2009 11:10 AM, Csaba Halász wrote:
That approach could also work.
Of course the real problem is that this code should never
have been performing an asin() in the first place. It's
been that way for many years, and it works OK in typical
cases, but it is unphysical and (as we have
9 matches
Mail list logo