2 Conventions
2.1 Coordinates system
Each optical element in Goptical lives in its own coordinates system. It's usually located at (0, 0, 0) with the Z axis being the local optical axis.
![](coordinates.png)
2.2 Measurement units
Lengths are expressed using millimeter unit.
Wavelengths are expressed in nanometer unit in vacuum.
Absolute refractive indexes are used, with 1 being the refractive index of vacuum.
2.3 Object references
C++ objects are used to model optical elements, materials, curvatures, shapes and other kinds of object Goptical deals with. As the optical system is being built, some objects keep references to other objects.
The ref smart pointer class is used to manage objects in a convenient way. Objects can either be statically allocated or dynamically allocated. Both can then be passed to reference holder objects in the same way but only dynamically allocated objects will be automatically deleted when not used anymore:
using namespace Goptical;
Sys::System sys;
// statically allocated object added to the system
Sys::SourceRays src1(Math::vector3_0);
sys.add(src1);
// dynamically allocated object added to the system
ref<Sys::SourceRays> src2 = ref<Sys::SourceRays>::create(Math::vector3_0);
sys.add(src2);