Board index FlightGear Development Nasal

Trigonometric Functions in Nasal

Nasal is the scripting language of FlightGear.

Trigonometric Functions in Nasal

Postby omega95 » Thu Feb 02, 2012 2:40 pm

Hey, I'm working on a TCAS and Navigation Display for the 787 (it's quite different from 747 and 777, so I need to make a new one) and to calculate some angles fr the vnav altitude graph, I need to use a few trig functions. How do I use them in nasal scripts?

I'll just need some simple functions like sin, cos, tan, arcsin, arccos and arctan.

Thanks a lot!
Merlion Virtual Airlines - the experience of a flight time...
Get high quality aircraft, airports, video tutorials or development tools from my hangar.
Posts: 1223
Joined: Sat Jul 30, 2011 12:59 am
Location: -unknown-
Callsign: MIA0001, OM-EGA
IRC name: omega95
Version: 2.12 git
OS: Ubuntu 13.04

Re: Trigonometric Functions in Nasal

Postby Hooray » Thu Feb 02, 2012 2:47 pm

These functions can be found in the "math" namespace:
Math Library

Returns the sine of the single argument
Returns the cosine of the single argument
Returns e (Euler's constant) raised to the power specified by the single argument
Returns the natural logarithm of the single argument.
Returns the square root of the single argument.
math.atan2(x, y)
Returns the arctangent of y/x, with the correct sign for the quadrant. Wraps the ANSI C function of the same name.
Euler's constant: 2.7182818284590452354
Pi: 3.14159265358979323846
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Posts: 10587
Joined: Tue Mar 25, 2008 8:40 am

Return to Nasal

Who is online

Users browsing this forum: No registered users and 1 guest