395
edits
m (Robot: Cosmetic changes) |
Philosopher (talk | contribs) m (found this old page via {{WIP}} - now a stub) |
||
Line 1: | Line 1: | ||
{{ | {{Stub}} | ||
'''Expressions''' (or '''SGExpressions''') are a feature of the SimGear library and provide a nice way of implementing complex math formulas using XML syntax. | |||
Expressions are a feature of the SimGear library and provide a nice way of implementing complex math formulas using XML syntax. | |||
They are supported in many systems within the FlightGear code. | They are supported in many systems within the FlightGear code. | ||
'''Beware:''' Expressions do not check if your math creates floating point exceptions | |||
'''Beware:''' Expressions do not check if your math creates floating point exceptions (like division by zero conditions, taking the square root of a negative number, etc.). This can cause undefined behavior and may result in NaNs or even [[Cascading Not-a-Number Errors|Cascading NaNs]]. | |||
== Usage == | == Usage == | ||
Expressions are supported in | Expressions are supported in | ||
* [[Autopilot Configuration Reference#Expressions|Autopilot configuration files]] | * [[Autopilot Configuration Reference#Expressions|Autopilot configuration files]] | ||
* | * Particle system configuration files | ||
* Animations (translate, rotate, scale, range, blend) | * Animations (translate, rotate, scale, range, blend) | ||
* The shader technique | * The shader technique | ||
Line 14: | Line 14: | ||
== Sample Expressions == | == Sample Expressions == | ||
This is a sample expression for c = sqrt(a*a + b^2) | This is a sample expression for c = sqrt(a*a + b^2) | ||
<syntaxhighlight lang="xml"> | |||
<expression> | |||
<sqrt> | |||
<sum> | |||
<product> | |||
<property>/value/a</property> | |||
<property>/value/a</property> | |||
</product> | |||
<pow> | |||
<property>/value/b</property> | |||
<value>2</value> | |||
</pow> | |||
</sum> | |||
</sqrt> | |||
</expression> | |||
</syntaxhighlight> | |||
== Supported elements == | == Supported elements == | ||
<syntaxhighlight lang="xml"> | |||
<acos> | |||
<asin> | |||
<atan> | |||
<ceil> | |||
<cos> | |||
<cosh> | |||
<exp> | |||
<floor> | |||
<log> | |||
<log10> | |||
<rad2deg> | |||
<sin> | |||
<sinh> | |||
<sqrt> | |||
<tan> | |||
<tanh> | |||
<atan2> | |||
<div> | |||
<mod> | |||
<pow> | |||
<value> | |||
<property> | |||
<abs> <!-- also: fabs --> | |||
<sqr> | |||
<clip> | |||
<div> | |||
<mod> | |||
<sum> | |||
<difference> <!-- also: dif --> | |||
<product> <!-- also: prod --> | |||
<min> | |||
<max> | |||
<table> | |||
</syntaxhighlight> |
edits