Members
(constant) DATA_VERSION :number
The version of the JSON data format of the scene, which matches the major version number of the app starting from version 5.0.
Type:
- number
- Source:
(constant) usePreferencesStore
Create a Vue store for application preferences that persist to localStorage
- Source:
(constant) useSceneStore
Create a Vue store for the scene, which is a wrapper around the Ray Optics Simulation core library Scene class. /** Create a Vue store for the scene, which is a wrapper around the Ray Optics Simulation core library Scene class.
- Source:
(constant) useStatusStore
Create a Vue store for application status
- Source:
(constant) vTooltipPopover
Vue directive for handling Bootstrap tooltips and popovers Usage:
- For tooltips: v-tooltip-popover="{ title: 'Tooltip text' }"
- For popovers: v-tooltip-popover:popover="{ title: 'Title', content: 'Content', popoverImage: 'image.svg' }"
- Source:
Methods
CircleObjMixin(Base) → {T}
The mixin for the scene objects that are defined by a circle.
Parameters:
Name | Type | Description |
---|---|---|
Base |
T |
- Source:
Returns:
- Type
- T
LineObjMixin(Base) → {T}
The mixin for the scene objects that are defined by a line segment.
Parameters:
Name | Type | Description |
---|---|---|
Base |
T |
- Source:
Returns:
- Type
- T
checkRayIntersectsShape(ray) → {Point}
Check if a ray intersects the circle.
In the child class, this can be called from the checkRayIntersects
method.
Parameters:
Name | Type | Description |
---|---|---|
ray |
Ray | The ray. |
- Source:
Returns:
The intersection point, or null if there is no intersection.
- Type
- Point
checkRayIntersectsShape(ray) → {Point}
Check if a ray intersects the line segment.
In the child class, this can be called from the checkRayIntersects
method.
Parameters:
Name | Type | Description |
---|---|---|
ray |
Ray | The ray. |
- Source:
Returns:
The intersection point, or null if there is no intersection.
- Type
- Point
setViewportSize(width, height)
Set the size (in CSS pixels) for the viewport of the scene.
Parameters:
Name | Type | Description |
---|---|---|
width |
number | |
height |
number |
- Source:
toJSON() → {string}
Convert the scene to JSON.
- Source:
Returns:
The JSON string representing the scene.
- Type
- string
useStatus() → {Object}
Composable for handling application status including mouse position, simulator metrics, and system status (errors/warnings)
- Source:
Returns:
Reactive status state and computed properties
- Type
- Object
versionUpdate(jsonData) → {Object}
Update the scene JSON data to the latest version.
Parameters:
Name | Type | Description |
---|---|---|
jsonData |
Object |
- Source:
Returns:
The updated JSON data.
- Type
- Object
Type Definitions
BodyMergingObj
Every ray has a temporary bodyMerging object ("bodyMergingObj") as a property (this property exists only while the ray is inside a region of one or several overlapping grin objects - e.g. CircleGrinGlass and GrinGlass), which gets updated as the ray enters/exits into/from grin objects, using the "multRefIndex"/"devRefIndex" function, respectively.
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
fn_p |
function | The refractive index function for the equivalent region of the simulation. |
fn_p_der_x |
function | The x derivative of |
fn_p_der_y |
function | The y derivative of |
- Source:
Circle
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
c |
Point | |
r |
number | Line |
- Source:
ConstructReturn
Type:
- Object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
isDone |
boolean |
<optional> |
Whether the construction is done. |
requiresObjBarUpdate |
boolean |
<optional> |
Whether the object bar should be updated. |
isCancelled |
boolean |
<optional> |
Whether the construction is cancelled. |
- Source:
ControlPoint
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
dragContext |
DragContext | The drag context of the virtual mouse that is dragging the control point. |
newPoint |
Point | The new position of the control point. |
- Source:
DragContext
Type:
- Object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
part |
number | The index of the part within the object being dragged. 0 for the whole object. |
|
targetPoint |
Point |
<optional> |
The target point where the user is dragging. This is recognized by the editor so that it can be used for popping up the coordinate box (when the user double-clicks or right-clicks such a point), or binding to a handle (when the user holds Ctrl and clicks such a point). |
targetPoint_ |
Point |
<optional> |
If this property is set instead of setting |
requiresObjBarUpdate |
boolean |
<optional> |
Whether the object bar should be updated during the dragging. |
cursor |
string |
<optional> |
The cursor to be used during hovering and dragging. |
snapContext |
SnapContext |
<optional> |
The snap context. |
hasDuplicated |
boolean |
<optional> |
Whether the object is duplicated during the dragging. This is true when the user holds the Ctrl key and drags the whole object. Only set by the editor. |
originalObj |
BaseSceneObj |
<optional> |
The original object when the dragging starts. Only set by the editor. |
isByHandle |
boolean |
<optional> |
Whether the dragging is initiated by dragging a handle. Only set by the editor. |
- Source:
Line
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
p1 |
Point | |
p2 |
Point |
- Source:
ModuleDef
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
numPoints |
number | The number of control points of the module. |
params |
Array.<string> | The parameters of the module. |
objs |
Array.<Object> | The objects in the module in the form of JSON objects with template syntax. |
maxLoopLength |
number | The maximum length of the list in for loops to prevent infinite loops. |
Point
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
x |
number | |
y |
number |
- Source:
Ray
Type:
- Object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
p1 |
Point | The starting point of the ray. |
|
p2 |
Point | Another point on the ray. |
|
brightness_s |
number | he intensity of the s-polarization component of the ray. |
|
brightness_p |
number | The intensity of the p-polarization component of the ray. In this simulator the two polarization components are assumed to be of no phase coherence. |
|
wavelength |
number |
<optional> |
The wavelength of the ray in nanometers. Only has effect when "Simulate Colors" is on. |
gap |
boolean | Whether the ray is the first ray in a bunch of "continuous" rays. This is for the detection of images to work correctly. The intersection of two rays is considered as a candidate of an image only if the second ray has |
|
isNew |
boolean | Whether the ray is just emitted by a source. This is to avoid drawing trivial initial extensions in the "Extended rays" mode. |
- Source:
SelectionSearchResult
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
dragContext |
DragContext | The drag context. |
targetObjIndex |
number | The index of the target object. |
- Source:
SimulationReturn
Type:
- Object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
isAbsorbed |
boolean |
<optional> |
Whether the object absorbs the ray. |
newRays |
Array.<Ray> |
<optional> |
The new rays to be added. |
truncation |
number |
<optional> |
The brightness of truncated rays due to numerical cutoff (e.g. after a large number of partial internal reflections within a glass). This is used to estimate the error of the simulation. |
brightnessScale |
number |
<optional> |
The actual brightness of the ray divided by the brightness inferred from the properties of the object. This should be 1 when "ray density" is high enough. When "ray density" is low, the calculated brightness of the individual rays will be too high (alpha value for rendering will be larger than 1). In this case, the object should rescale all the brightness of the rays by a factor to keep the maximum alpha value to be 1. This factor should be returned here and is used to generate warnings. |
- Source:
SnapContext
Type:
- Object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
locked |
boolean |
<optional> |
Whether the snapping direction is locked. |
i0 |
number |
<optional> |
The index of the locked direction. |
- Source:
loadJSONCallback(needFullUpdate, completed)
The callback function when the entire scene or a resource (e.g. image) is loaded.
Parameters:
Name | Type | Description |
---|---|---|
needFullUpdate |
boolean | Whether the scene needs a full update. |
completed |
boolean | Whether the scene is completely loaded. |
- Source:
objBarValueChangeCallback(obj, value)
The callback function for when a value changes. If "Apply to all" is checked, this function will be called for each scene object of the same type.
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object | The scene object whose value changed. |
value |
any | The new value. |
- Source:
Events
requestUpdateErrorAndWarning
The event when the error and warning messages in the UI should be updated.
- Source:
requestUpdateErrorAndWarning
The event when the error and warning messages in the UI should be updated.
- Source:
webglContextLost
The event when the WebGL context is lost.
- Source: