Generating Source Code

Generating Source Code

Top  Previous  Next

You can generate computer source code from Geometry Expressions in a number of different languages.

source code 

There are two types of expression in Geometry Expressions:

  • Scalar
  • Vector

The source code will be in a different form depending on whether there are intermediate variables present or not.

Note that there is not much difference between the languages in the mathematical expressions they generate.  The main differences are:

  • C#, Java, Javascript, ActionScript, Visual Basic (.net), and Lua prefixes math functions with “Math.”
  • C / C++ and VBA do not use any prefix for the math functions

Each language has its own way of invoking functions.  In the cases where a vector is returned from the function, the different languages work in different ways.

  • In C pointers to doubles representing the x and y coordinates of the vector are passed into the function.
  • In C++, Visual Basic and VBA, references to doubles representing the x and y coordinates of the vector are passed into the function.
  • In C# double out parameters for the x and y coordinates of the vector are used.
  • In Java, JavaScript and ActionScript, an array is passed into the function, the 0th and 1st elements of the array will acquire the x and y coordinates of the vector.