LaserCanvas 5 > Optics >
Using equations and variables provides a very flexible way to design a cavity in a specific way. Many optic and system properties can be defined using equations that depend on any of the LaserCanvas variables.
LaserCanvas provides three variables, called "x", "y", and "z". Each of these variables has a specific value at any given time. The value is the same for all systems that are open at the same time. The system that results for the given variable values is the one that is displayed in the Canvas.
Each variable also has an associated range. You can create graphs of system or optic properties as a function of the variables. When the system is changed, for example when you drag optics with the mouse, each variable is scanned through its range, and the graphs update to show the effect of the variable sweep in the new system.
Properties that can be entered as equations are displayed with a green font in the Property Manager. The value displayed in the Property Manager is the equation value for the given variable values. You can choose to have the source equations displayed by selecting menu Tools | Property Equations or clicking the Show
An equation can consist of operators, functions, values, variable names, constants, and brackets. The recognized symbols are listed in the table below.
Type | Recognized Symbols |
Binary Operators | +, –, *, /, ^ |
Functions | abs, acos, asin, atan, ceil, cos, cosh, exp, floor, log, log10, sin, sinh, sqrt, tan, tanh |
Constants | pi |
Comparators | <, <=, ==, >=, >, != |
Logical Operators | &, &&, |, ||, !() |
Variables | Any allowed variable name |
An example of a valid equation is
x^2 + (cos(3*pi*y) – (z > 0)*floor(z))/2
Any spaces in the equation are ignored.
If an expression evaluates to a constant value, i.e., if the equation does not contain any references to LaserCanvas variables, you can enter it into any field that expects a constant. For example, entering
0.707 and sqrt(2)/2
are interchangeable.
The exception is in fields that expect two values separated by a comma, for example the Variable Range field in the Property Manager.