## Trigonometric Functions in Nasal

Nasal is the scripting language of FlightGear.

### Trigonometric Functions in Nasal

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.
omega95

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

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

http://plausible.org/nasal/lib.html
Math Library

math.sin(number)
Returns the sine of the single argument
math.cos(number)
Returns the cosine of the single argument
math.exp(number)
Returns e (Euler's constant) raised to the power specified by the single argument
math.ln(number)
Returns the natural logarithm of the single argument.
math.sqrt(number)
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.
math.e
Euler's constant: 2.7182818284590452354
math.pi
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,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray

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