Jump to content

gauge formula question


ngtw16a

Recommended Posts

Hi folks,

 

I'm tinkering around and wanted to create my own gauges

but I'm having an issue with the (backwards) syntax of the equation.

 

I've read the basic notes on variables ...but this calc is a little more complicated.

 

What I'm trying to say is:

 

L:RNAV_WP_RANGE,nmiles) = sqrt( sqr( (L:RNAV_PLANE_X) - (L:RNAV_WP_X) ) + sqr( (L:RNAV_PLANE_Y) - (L:RNAV_WP_Y) ) )

 

and this is what I've come up with...but I'm not sure it is correct. Wasn't sure how to handle nested ( )

 

Can I use parens or...do I put the squared values on the stack, and pop them off later??

 

(L:RNAV_PLANE_X) (L:RNAV_WP_X) - sqr (L:RNAV_PLANE_Y) (L:RNAV_WP_Y) - sqr + sqrt (>L:RNAV_WP_RANGE,nmiles);

 

any insight from the pros would be appreciated :)

 

~Pat in PA

Link to comment
Share on other sites

Looks OK to me. The easy way to test it is to set up the L: variables with known values (can be as simple as placing temporary code into the gauge assigning fixed values to those 4 variables) and check the value of the RANGE variable in a Text statement printed to the screen. Or use one of the more sophisticated variable display gauges if you like.

Tom Gibson

 

CalClassic Propliner Page: http://www.calclassic.com

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...