Type Definitions
ChangeInfos
Camera position/zoom, UI and pick changes.
Type:
Properties:
Name |
Type |
Attributes |
Description |
camera_position |
Object
|
<optional>
|
info: {camera_position: [a,b,c]}. |
camera_zoom |
Object
|
<optional>
|
zoom change: {camera_zoom: x}. |
axes |
boolean
|
<optional>
|
axes shown or hidden: {axes: false} |
axes0 |
boolean
|
<optional>
|
axes and grid centered at origin: {axes0: false} |
ortho |
boolean
|
<optional>
|
orthographic or perspective camera: {ortho: false} |
grid |
string
|
<optional>
|
visibility of grids as 3-dim array of boolean for grid xy, xz, yz: {"grid": [false, true, false]} |
lastPick |
string
|
<optional>
|
last object double clicked, see example below |
- Source:
Examples
{
"camera_zoom": 0.5},
"camera_position": [
686.1137426105751,
2.842170943040401e-14,
679.0741829484135
]
}
{
"lastPick": {
"path": "/Group",
"name": "Part_0",
"boundingBox": {
"min": {
"x": -0.5,
"y": -0.5,
"z": -0.5
},
"max": {
"x": 0.5,
"y": 0.5,
"z": 0.5
}
},
"boundingSphere": {
"center": {
"x": 0,
"y": 0,
"z": 0
},
"radius": 0.8660254037844386
}
}
}
ChangeNotification
Camera position/zoom, UI and pick change notification.
Type:
Properties:
Name |
Type |
Attributes |
Description |
camera_position |
Object
|
<optional>
|
position change, {camera_position:{new:[a,b,c], old:[x,y,z]}}.
Properties
Name |
Type |
Description |
new |
Vector3
|
new position. |
old |
Vector3
|
old position. |
|
camera_zoom |
Object
|
<optional>
|
zoom change, {camera_zoom:{new:x, old:y}}.
Properties
Name |
Type |
Description |
new |
number
|
new zoom value. |
old |
number
|
old zoom value. |
|
axes |
boolean
|
<optional>
|
visibility of axes
Properties
Name |
Type |
Description |
new |
boolean
|
new visibility of axes |
old |
boolean
|
old visibility of axes |
|
grid |
Object
|
<optional>
|
visibility of grids
Properties
Name |
Type |
Description |
new |
Array.<boolean>
|
new visibility of grids as 3-dim array of boolean for grid xy, xz, yz |
old |
Array.<boolean>
|
old visibility of grids |
|
lastPick |
Object
|
<optional>
|
last object double clicked
Properties
Name |
Type |
Description |
new |
Object
|
new object info, see example below |
old |
Object
|
old object info, see example below |
|
- Source:
Examples
{
"camera_zoom": {
"new": 0.5,
"old": 1
},
"camera_position": {
"new": [
686.1137426105751,
2.842170943040401e-14,
679.0741829484135
],
"old": [
559.6495141762458,
562.7012872475352,
552.6099545140844
]
}
}
{
"lastPick": {
"new": {
"path": "/Group",
"name": "Part_0",
"boundingBox": {
"min": {
"x": -0.5,
"y": -0.5,
"z": -0.5
},
"max": {
"x": 0.5,
"y": 0.5,
"z": 0.5
}
},
"boundingSphere": {
"center": {
"x": 0,
"y": 0,
"z": 0
},
"radius": 0.8660254037844386
}
},
"old": null
}
}
DisplayOptions
Display options.
Type:
Properties:
Name |
Type |
Attributes |
Default |
Description |
cadWidth |
number
|
<optional>
|
800
|
width of CAD canvas. |
height |
number
|
<optional>
|
600
|
height of CAD canvas. |
treeWidth |
number
|
<optional>
|
250
|
width of tree navigation. |
theme |
string
|
<optional>
|
"light"
|
theme ["light", "dark"] |
- Source:
Example
options = {
"theme": "light",
"height": 600,
"cadWidth": 800,
"treeWidth": 240,
}
Edge
Edge, a tuple of two Vector3s, start and and of a simple edge.
Type:
- Source:
Example
edge = [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]
NotificationCallback(change)
Callback for notifications.
Parameters:
- Source:
Quaternion
Quaternion, a 4-dim list of floats [x, y, z, w].
Type:
- Source:
Example
[x, y, z, w] = [0.5 0.5 0.5 0.5]
RenderOptions
Viewer options.
Type:
Properties:
Name |
Type |
Attributes |
Default |
Description |
edgeColor |
number
|
<optional>
|
0x707070
|
default edge color. |
ambientIntensity |
number
|
<optional>
|
0.5
|
ambient light intensity. |
directIntensity |
number
|
<optional>
|
0.3
|
direct light intensity. |
defaultOpacity |
number
|
<optional>
|
0.4
|
default opacity level for transparency. |
normalLen |
number
|
<optional>
|
0
|
show triangle normals when normalLen > 0. |
- Source:
Example
options = {
"normalLen": 0,
"ambientIntensity": 0.5,
"directIntensity": 0.3,
}
Shape
A tessellated 3D shape.
Type:
Properties:
Name |
Type |
Description |
vertices |
Array.<Vector3>
|
flattened list of 3-dim vertices defining the triangles. |
normals |
Array.<Vector3>
|
flattened list of 3-dim vertex normals. |
triangles |
Array.<number>
|
flattened list of 3-dim triangle id's per face. |
edges |
Array.<Edge>
|
list of edge segments defining an multi point edge per face. |
obj_vertices |
Array.<Vector3>
|
flattened list of 3-dim vertices of the CAD object. |
edge_types |
Array.<number>
|
OCP types of the edges. |
face_types |
Array.<number>
|
OCP types of the faces. |
- Source:
Example
shape: {
vertices: [
-0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5,
0.5, -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, -0.5,
-0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5,
0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, -0.5,
-0.5, -0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5,
0.5, -0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5,
],
triangles: [
1, 2, 0, 1, 3, 2, 5, 4, 6, 5, 6, 7, 11, 8, 9, 11, 10, 8, 15, 13, 12,
15, 12, 14, 19, 16, 17, 19, 18, 16, 23, 21, 20, 23, 20, 22,
],
normals: [
-1.0, -0.0, 0.0, -1.0, -0.0, 0.0, -1.0, -0.0, 0.0, -1.0, -0.0, 0.0,
1.0, 0.0, -0.0, 1.0, 0.0, -0.0, 1.0, 0.0, -0.0, 1.0, 0.0, -0.0, 0.0,
-1.0, -0.0, 0.0, -1.0, -0.0, 0.0, -1.0, -0.0, 0.0, -1.0, -0.0, -0.0,
1.0, 0.0, -0.0, 1.0, 0.0, -0.0, 1.0, 0.0, -0.0, 1.0, 0.0, -0.0, -0.0,
-1.0, -0.0, -0.0, -1.0, -0.0, -0.0, -1.0, -0.0, -0.0, -1.0, 0.0, 0.0,
1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0,
],
edges: [
-0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, 0.5, 0.5,
-0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5,
0.5, -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
0.5, -0.5, 0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5,
-0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, 0.5,
-0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
],
obj_vertices: [
-0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5,
0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5,
],
face_types: [0, 0, 0, 0, 0, 0],
edge_types: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
triangles_per_face: [2, 2, 2, 2, 2, 2],
segments_per_edge: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
}
Shapes
Hierachical/groupd objects of type Shape.
Type:
Properties:
Name |
Type |
Attributes |
Description |
version |
number
|
|
protocol version. |
name |
string
|
|
group name. |
id |
string
|
|
id of the group. It is a '/' separated path. |
loc |
Array
|
<optional>
|
a tuple of a 3-dim position [x,y,z] and a 4-dim quaternion [x,y,z,w] describing the group's location. |
parts |
Array.<Shapes>
|
<optional>
|
children of the group as list of shapes. |
shape |
Shape
|
<optional>
|
Shape object or null, if parts != null. |
type |
string
|
<optional>
|
object type: "shapes", edges", "vertices", if "shape" != null. |
subtype |
string
|
<optional>
|
object subtype: only for type=="shapes": "solid" or "faces", if "shape" != null. |
color |
string
|
<optional>
|
rbg object color in CSS format, if "shape" != null. |
alpha |
number
|
<optional>
|
object alpha transparency between 0 and 1, if "shape" != null. |
renderback |
boolean
|
<optional>
|
whether to render the back of the face or not, if "shape" != null. |
bb |
map
|
<optional>
|
bounding box as map with xmin, xmax, ymin, ymax, zmin, zmax, if "shape" != null. |
- Source:
Example
shapes = {
"version": 2,
"parts": [
{
"name": "Solid",
"id": "/Group/Solid",
"loc": [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.0]],
"shape": see Shape
"type": "shapes",
"subtype": "solid",
"color": "#e8b024",
"alpha": 1.0,
"renderback": false,
"accuracy": 0.002,
"states": [1,1],
"bb": {
"xmin": -0.5, "xmax": 0.5, "ymin": -1.0, "ymax": 1.0, "zmin": -1.5, "zmax": 1.5
}
}
],
"loc": [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 1.0]],
"name": "Group",
"id": "/Group"
}
Vector3
Vector3, a 3-dim list of floats [x,y,z].
Type:
- Source:
Example
[x, y, z] = [1.0, 2.0, 3.0]
ViewerOptions
Viewer options.
Type:
Properties:
Name |
Type |
Attributes |
Default |
Description |
control |
string
|
<optional>
|
"orbit"
|
use OrbitControls or TrackballControls. |
axes |
boolean
|
<optional>
|
false
|
show X-, Y-, Z-axes. |
axes0 |
boolean
|
<optional>
|
false
|
show axes at [0,0,0] ot at object center (target). |
grid |
Array.<boolean>
|
<optional>
|
[false, false, false]
|
initial grid setting, 3-dim. |
ortho |
boolean
|
<optional>
|
true
|
use an orthographic (true) or perspective camera (false) |
transparent |
boolean
|
<optional>
|
false
|
show CAD object trasparent. |
blackEdges |
boolean
|
<optional>
|
false
|
show edges in black and not in edgeColor. |
clipIntersection |
boolean
|
<optional>
|
false
|
use intersection clipping |
clipPlaneHelpers |
boolean
|
<optional>
|
false
|
show clipping planes |
clipNormal |
Array.<Array.<number>>
|
|
|
= [[-1,0,0], [0,-1,0], [0,0,-1]] - normal directions for clipping |
ticks |
number
|
<optional>
|
10
|
hint for the number of grid ticks. |
rotateSpeed |
number
|
<optional>
|
1.0
|
rotation speed. |
zoomSpeed |
number
|
<optional>
|
0.5
|
zooom speed. |
panSpeed |
number
|
<optional>
|
0.5
|
pan speed. |
position |
Array.<number>
|
<optional>
|
null
|
camera position as 3-dim array |
quaternion |
Array.<number>
|
<optional>
|
null
|
camera rotation as 4-dim quaternion array [x,y,z,w] |
zoom |
number
|
<optional>
|
null
|
camera zoom value |
zoom0 |
number
|
<optional>
|
1.0
|
initial zoom factor. |
tools |
boolean
|
<optional>
|
true
|
Show/hide all tools. |
timeit |
boolean
|
<optional>
|
false
|
show timings in browser console. |
- Source:
Example
options = {
"ortho": true,
"ticks": 10,
"transparent": false,
"axes": true,
"grid": [false, false, false],
"timeit": false,
"rotateSpeed": 1
}
domEventCallback(event)
Callback for dom events.
Parameters:
Name |
Type |
Description |
event |
event
|
DOM event |
- Source: