Home

Editor.js

Editor is the main class for visually editing the Scene data. It manages the user interactions with the canvas, such as dragging objects, selecting objects, and adding objects. It also manages the undo and redo operations and the crop mode. Rendering is not done by this class, but by the Simulator class. Also, the UI update (e.g. object bar) is not done by this class. When UI update is needed, this class emits events to notify the UI to update.

Source:

Scene.js

Scene is the class representing the optical scene for simulation, containing the instances from sceneObjs (optical elements, decorations, etc) and the settings of the scene. It is the main data structure of the app and can be serialized to (and deserialized from) JSON.

Source:

Simulator.js

Simulator is the class for simulating the optical system described by the Scene class and rendering the scene (optical elements, decorations, rays, etc) on the canvas layers. It can also be used in a standalone environment (e.g. Node.js).

Source:

app.js

app.js is the main entry point for the Ray Optics Simulator web app. It handles the initialzation of the UI and the main instances of Scene, Simulator and Editor, and binds events to them. It also handles some app-level operation such as loading files.

Source:

sceneObjs.js

sceneObjs is the namespace for all the classes representing objects that can be added to the scene. Scene objects include optical elements (e.g. mirrors, lenses), detectors, decorations (e.g. rulers, text labels), and special objects (e.g. handles, cropboxes).

Source: