awv3
Version:
AWV client CAD framework
1,647 lines (1,646 loc) • 979 kB
JSON
{
"type": "Program",
"start": 0,
"end": 9819,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 254,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 57,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 57
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 8,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 13
}
},
"imported": {
"type": "Identifier",
"start": 8,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 13
}
},
"name": "Point"
},
"local": {
"type": "Identifier",
"start": 8,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 13
}
},
"name": "Point"
}
},
{
"type": "ImportSpecifier",
"start": 15,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 19
}
},
"imported": {
"type": "Identifier",
"start": 15,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 19
}
},
"name": "Line"
},
"local": {
"type": "Identifier",
"start": 15,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 19
}
},
"name": "Line"
}
},
{
"type": "ImportSpecifier",
"start": 21,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 24
}
},
"imported": {
"type": "Identifier",
"start": 21,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 24
}
},
"name": "Arc"
},
"local": {
"type": "Identifier",
"start": 21,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 24
}
},
"name": "Arc"
}
}
],
"importKind": "value",
"source": {
"type": "Literal",
"start": 31,
"end": 56,
"loc": {
"start": {
"line": 1,
"column": 31
},
"end": {
"line": 1,
"column": 56
}
},
"value": "../sketcher/geomobjects",
"rawValue": "../sketcher/geomobjects",
"raw": "'../sketcher/geomobjects'"
}
},
{
"type": "ImportDeclaration",
"start": 58,
"end": 84,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 26
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 65,
"end": 70,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 12
}
},
"local": {
"type": "Identifier",
"start": 65,
"end": 70,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 12
}
},
"name": "THREE"
}
}
],
"importKind": "value",
"source": {
"type": "Literal",
"start": 76,
"end": 83,
"loc": {
"start": {
"line": 2,
"column": 18
},
"end": {
"line": 2,
"column": 25
}
},
"value": "three",
"rawValue": "three",
"raw": "'three'"
}
},
{
"type": "ExpressionStatement",
"start": 86,
"end": 196,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 6,
"column": 2
}
},
"expression": {
"type": "AssignmentExpression",
"start": 86,
"end": 195,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 6,
"column": 1
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 86,
"end": 99,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 13
}
},
"object": {
"type": "Identifier",
"start": 86,
"end": 91,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 5
}
},
"name": "THREE"
},
"property": {
"type": "Identifier",
"start": 92,
"end": 99,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 13
}
},
"name": "cross2d"
},
"computed": false
},
"right": {
"type": "FunctionExpression",
"start": 102,
"end": 195,
"loc": {
"start": {
"line": 4,
"column": 16
},
"end": {
"line": 6,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 92,
"end": 99,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 13
}
},
"name": "cross2d"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 111,
"end": 112,
"loc": {
"start": {
"line": 4,
"column": 25
},
"end": {
"line": 4,
"column": 26
}
},
"name": "a"
},
{
"type": "Identifier",
"start": 114,
"end": 115,
"loc": {
"start": {
"line": 4,
"column": 28
},
"end": {
"line": 4,
"column": 29
}
},
"name": "b"
}
],
"body": {
"type": "BlockStatement",
"start": 117,
"end": 195,
"loc": {
"start": {
"line": 4,
"column": 31
},
"end": {
"line": 6,
"column": 1
}
},
"body": [
{
"type": "ReturnStatement",
"start": 164,
"end": 193,
"loc": {
"start": {
"line": 5,
"column": 4
},
"end": {
"line": 5,
"column": 33
}
},
"argument": {
"type": "BinaryExpression",
"start": 171,
"end": 192,
"loc": {
"start": {
"line": 5,
"column": 11
},
"end": {
"line": 5,
"column": 32
}
},
"left": {
"type": "BinaryExpression",
"start": 171,
"end": 180,
"loc": {
"start": {
"line": 5,
"column": 11
},
"end": {
"line": 5,
"column": 20
}
},
"left": {
"type": "MemberExpression",
"start": 171,
"end": 174,
"loc": {
"start": {
"line": 5,
"column": 11
},
"end": {
"line": 5,
"column": 14
}
},
"object": {
"type": "Identifier",
"start": 171,
"end": 172,
"loc": {
"start": {
"line": 5,
"column": 11
},
"end": {
"line": 5,
"column": 12
}
},
"name": "a",
"leadingComments": null
},
"property": {
"type": "Identifier",
"start": 173,
"end": 174,
"loc": {
"start": {
"line": 5,
"column": 13
},
"end": {
"line": 5,
"column": 14
}
},
"name": "x"
},
"computed": false,
"leadingComments": null
},
"operator": "*",
"right": {
"type": "MemberExpression",
"start": 177,
"end": 180,
"loc": {
"start": {
"line": 5,
"column": 17
},
"end": {
"line": 5,
"column": 20
}
},
"object": {
"type": "Identifier",
"start": 177,
"end": 178,
"loc": {
"start": {
"line": 5,
"column": 17
},
"end": {
"line": 5,
"column": 18
}
},
"name": "b"
},
"property": {
"type": "Identifier",
"start": 179,
"end": 180,
"loc": {
"start": {
"line": 5,
"column": 19
},
"end": {
"line": 5,
"column": 20
}
},
"name": "y"
},
"computed": false
},
"leadingComments": null
},
"operator": "-",
"right": {
"type": "BinaryExpression",
"start": 183,
"end": 192,
"loc": {
"start": {
"line": 5,
"column": 23
},
"end": {
"line": 5,
"column": 32
}
},
"left": {
"type": "MemberExpression",
"start": 183,
"end": 186,
"loc": {
"start": {
"line": 5,
"column": 23
},
"end": {
"line": 5,
"column": 26
}
},
"object": {
"type": "Identifier",
"start": 183,
"end": 184,
"loc": {
"start": {
"line": 5,
"column": 23
},
"end": {
"line": 5,
"column": 24
}
},
"name": "a"
},
"property": {
"type": "Identifier",
"start": 185,
"end": 186,
"loc": {
"start": {
"line": 5,
"column": 25
},
"end": {
"line": 5,
"column": 26
}
},
"name": "y"
},
"computed": false
},
"operator": "*",
"right": {
"type": "MemberExpression",
"start": 189,
"end": 192,
"loc": {
"start": {
"line": 5,
"column": 29
},
"end": {
"line": 5,
"column": 32
}
},
"object": {
"type": "Identifier",
"start": 189,
"end": 190,
"loc": {
"start": {
"line": 5,
"column": 29
},
"end": {
"line": 5,
"column": 30
}
},
"name": "b"
},
"property": {
"type": "Identifier",
"start": 191,
"end": 192,
"loc": {
"start": {
"line": 5,
"column": 31
},
"end": {
"line": 5,
"column": 32
}
},
"name": "x"
},
"computed": false
}
},
"leadingComments": null
},
"leadingComments": [
{
"type": "CommentLine",
"value": "TODO: properly install into THREE?...",
"start": 120,
"end": 159,
"loc": {
"start": {
"line": 4,
"column": 34
},
"end": {
"line": 4,
"column": 73
}
},
"range": [
120,
159
]
}
]
}
]
}
}
}
},
{
"type": "ExportNamedDeclaration",
"start": 198,
"end": 1024,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 25,
"column": 1
}
},
"declaration": {
"type": "FunctionDeclaration",
"start": 205,
"end": 1024,
"loc": {
"start": {
"line": 8,
"column": 7
},
"end": {
"line": 25,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 214,
"end": 229,
"loc": {
"start": {
"line": 8,
"column": 16
},
"end": {
"line": 8,
"column": 31
}
},
"name": "drawArcBy_S_T_E"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 230,
"end": 238,
"loc": {
"start": {
"line": 8,
"column": 32
},
"end": {
"line": 8,
"column": 40
}
},
"name": "startPos"
},
{
"type": "Identifier",
"start": 240,
"end": 252,
"loc": {
"start": {
"line": 8,
"column": 42
},
"end": {
"line": 8,
"column": 54
}
},
"name": "startTangent"
},
{
"type": "Identifier",
"start": 254,
"end": 260,
"loc": {
"start": {
"line": 8,
"column": 56
},
"end": {
"line": 8,
"column": 62
}
},
"name": "endPos"
}
],
"body": {
"type": "BlockStatement",
"start": 262,
"end": 1024,
"loc": {
"start": {
"line": 8,
"column": 64
},
"end": {
"line": 25,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 308,
"end": 347,
"loc": {
"start": {
"line": 10,
"column": 4
},
"end": {
"line": 10,
"column": 43
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 312,
"end": 346,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 10,
"column": 42
}
},
"id": {
"type": "Identifier",
"start": 312,
"end": 315,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 10,
"column": 11
}
},
"name": "dir",
"leadingComments": null
},
"init": {
"type": "CallExpression",
"start": 318,
"end": 346,
"loc": {
"start": {
"line": 10,
"column": 14
},
"end": {
"line": 10,
"column": 42
}
},
"callee": {
"type": "MemberExpression",
"start": 318,
"end": 336,
"loc": {
"start": {
"line": 10,
"column": 14
},
"end": {
"line": 10,
"column": 32
}
},
"object": {
"type": "CallExpression",
"start": 318,
"end": 332,
"loc": {
"start": {
"line": 10,
"column": 14
},
"end": {
"line": 10,
"column": 28
}
},
"callee": {
"type": "MemberExpression",
"start": 318,
"end": 330,
"loc": {
"start": {
"line": 10,
"column": 14
},
"end": {
"line": 10,
"column": 26
}
},
"object": {
"type": "Identifier",
"start": 318,
"end": 324,
"loc": {
"start": {
"line": 10,
"column": 14
},
"end": {
"line": 10,
"column": 20
}
},
"name": "endPos"
},
"property": {
"type": "Identifier",
"start": 325,
"end": 330,
"loc": {
"start": {
"line": 10,
"column": 21
},
"end": {
"line": 10,
"column": 26
}
},
"name": "clone"
},
"computed": false
},
"arguments": []
},
"property": {
"type": "Identifier",
"start": 333,
"end": 336,
"loc": {
"start": {
"line": 10,
"column": 29
},
"end": {
"line": 10,
"column": 32
}
},
"name": "sub"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 337,
"end": 345,
"loc": {
"start": {
"line": 10,
"column": 33
},
"end": {
"line": 10,
"column": 41
}
},
"name": "startPos"
}
]
},
"leadingComments": null
}
],
"kind": "var",
"leadingComments": [
{
"type": "CommentLine",
"value": "should we create a line or an arc",
"start": 268,
"end": 303,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 9,
"column": 39
}
},
"range": [
268,
303
]
}
]
},
{
"type": "VariableDeclaration",
"start": 352,
"end": 429,
"loc": {
"start": {
"line": 11,
"column": 4
},
"end": {
"line": 11,
"column": 81
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 356,
"end": 428,
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 80
}
},
"id": {
"type": "Identifier",
"start": 356,
"end": 362,
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 14
}
},
"name": "onLine"
},
"init": {
"type": "CallExpression",
"start": 365,
"end": 428,
"loc": {
"start": {
"line": 11,
"column": 17
},
"end": {
"line": 11,
"column": 80
}
},
"callee": {
"type": "MemberExpression",
"start": 365,
"end": 385,
"loc": {
"start": {
"line": 11,
"column": 17
},
"end": {
"line": 11,
"column": 37
}
},
"object": {
"type": "CallExpression",
"start": 365,
"end": 381,
"loc": {
"start": {
"line": 11,
"column": 17
},
"end": {
"line": 11,
"column": 33
}
},
"callee": {
"type": "MemberExpression",
"start": 365,
"end": 379,
"loc": {
"start": {
"line": 11,
"column": 17
},
"end": {
"line": 11,
"column": 31
}
},
"object": {
"type": "Identifier",
"start": 365,
"end": 373,
"loc": {
"start": {
"line": 11,
"column": 17
},
"end": {
"line": 11,
"column": 25
}
},
"name": "startPos"
},
"property": {
"type": "Identifier",
"start": 374,
"end": 379,
"loc": {
"start": {
"line": 11,
"column": 26
},
"end": {
"line": 11,
"column": 31
}
},
"name": "clone"
},
"computed": false
},
"arguments": []
},
"property": {
"type": "Identifier",
"start": 382,
"end": 385,
"loc": {
"start": {
"line": 11,
"column": 34
},
"end": {
"line": 11,
"column": 37
}
},
"name": "add"
},
"computed": false
},
"arguments": [
{
"type": "CallExpression",
"start": 386,
"end": 427,
"loc": {
"start": {
"line": 11,
"column": 38
},
"end": {
"line": 11,
"column": 79
}
},
"callee": {
"type": "MemberExpression",
"start": 386,
"end": 413,
"loc": {
"start": {
"line": 11,
"column": 38
},
"end": {
"line": 11,
"column": 65
}
},
"object": {
"type": "CallExpression",
"start": 386,
"end": 397,
"loc": {
"start": {
"line": 11,
"column": 38
},
"end": {
"line": 11,
"column": 49
}
},
"callee": {
"type": "MemberExpression",
"start": 386,
"end": 395,
"loc": {
"start": {
"line": 11,
"column": 38
},
"end": {
"line": 11,
"column": 47
}
},
"object": {
"type": "Identifier",
"start": 386,
"end": 389,
"loc": {
"start": {
"line": 11,
"column": 38
},
"end": {
"line": 11,
"column": 41
}
},
"name": "dir"
},
"property": {
"type": "Identifier",
"start": 390,
"end": 395,
"loc": {
"start": {
"line": 11,
"column": 42
},
"end": {
"line": 11,
"column": 47
}
},
"name": "clone"
},
"computed": false
},
"arguments": []
},
"property": {
"type": "Identifier",
"start": 398,
"end": 413,
"loc": {
"start": {
"line": 11,
"column": 50
},
"end": {
"line": 11,
"column": 65
}
},
"name": "projectOnVector"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 414,
"end": 426,
"loc": {
"start": {
"line": 11,
"column": 66
},
"end": {
"line": 11,
"column": 78
}
},
"name": "startTangent"
}
]
}
]
}
}
],
"kind": "var"
},
{
"type": "VariableDeclaration",
"start": 434,
"end": 473,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 43
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 438,
"end": 472,
"loc": {
"start": {
"line": 12,
"column": 8
},
"end": {
"line": 12,
"column": 42
}
},
"id": {
"type": "Identifier",
"start": 438,
"end": 444,
"loc": {
"start": {
"line": 12,
"column": 8
},
"end": {
"line": 12,
"column": 14
}
},
"name": "height"
},
"init": {
"type": "CallExpression",
"start": 447,
"end": 472,
"loc": {
"start": {
"line": 12,
"column": 17
},
"end": {
"line": 12,
"column": 42
}
},
"callee": {
"type": "MemberExpression",
"start": 447,
"end": 464,
"loc": {
"start": {
"line": 12,
"column": 17
},
"end": {
"line": 12,
"column": 34
}
},
"object": {
"type": "Identifier",
"start": 447,
"end": 453,
"loc": {
"start": {
"line": 12,
"column": 17
},
"end": {
"line": 12,
"column": 23
}
},
"name": "onLine"
},
"property": {
"type": "Identifier",
"start": 454,
"end": 464,
"loc": {
"start": {
"line": 12,
"column": 24
},
"end": {
"line": 12,
"column": 34
}
},
"name": "distanceTo"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 465,
"end": 471,
"loc": {
"start": {
"line": 12,
"column": 35
},
"end": {
"line": 12,
"column": 41
}
},
"name": "endPos"
}
]
}
}
],
"kind": "var"
},
{
"type": "VariableDeclaration",
"start": 478,
"end": 532,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 58
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 482,
"end": 531,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 57
}
},
"id": {
"type": "Identifier",
"start": 482,
"end": 490,
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 16
}
},
"name": "isLinear"
},
"init": {
"type": "BinaryExpression",
"start": 494,
"end": 530,
"loc": {
"start": {
"line": 13,
"column": 20
},
"end": {
"line": 13,
"column": 56
}
},
"left": {
"type": "Identifier",
"start": 494,
"end": 500,
"loc": {
"start": {
"line": 13,
"column": 20
},
"end": {
"line": 13,
"column": 26
}
},
"name": "height"
},
"operator": "<=",
"right": {
"type": "BinaryExpression",
"start": 504,
"end": 530,
"loc": {
"start": {
"line": 13,
"column": 30
},
"end": {
"line": 13,
"column": 56
}
},
"left": {
"type": "BinaryExpression",
"start": 504,
"end": 523,
"loc": {
"start": {
"line": 13,
"column": 30
},
"end": {
"line": 13,
"column": 49
}
},
"left": {
"type": "CallExpression",
"start": 504,
"end": 516,
"loc": {
"start": {
"line": 13,
"column": 30
},
"end": {
"line": 13,
"column": 42
}
},
"callee": {
"type": "MemberExpression",
"start": 504,
"end": 514,
"loc": {
"start": {
"line": 13,
"column": 30
},
"end": {
"line": 13,
"column": 40
}
},
"object": {
"type": "Identifier",
"start": 504,
"end": 507,
"loc": {
"start": {
"line": 13,
"column": 30
},
"end": {
"line": 13,
"column": 33
}
},
"name": "dir"
},
"property": {
"type": "Identifier",
"start": 508,
"end": 514,
"loc": {
"start": {
"line": 13,
"column": 34
},
"end": {
"line": 13,
"column": 40
}
},
"name": "length"
},
"computed": false
},
"arguments": []
},
"operator": "*",
"right": {
"type": "Literal",
"start": 519,
"end": 523,
"loc": {
"start": {
"line": 13,
"column": 45
},
"end": {
"line": 13,
"column": 49
}
},
"value": 0.001,
"rawValue": 0.001,
"raw": "1e-3"
}
},
"operator": "+",
"right": {
"type": "Literal",
"start": 526,
"end": 530,
"loc": {
"start": {
"line": 13,
"column": 52
},
"end": {
"line": 13,
"column": 56
}
},
"value": 0.001,
"rawValue": 0.001,
"raw": "1e-3"