awv3
Version:
⚡ AWV3 embedded CAD
1,510 lines • 2.73 MB
JSON
{
"type": "File",
"start": 0,
"end": 12574,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 319,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 12574,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 319,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 31
}
},
"specifiers": [
{
"type": "ImportNamespaceSpecifier",
"start": 7,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 17
}
},
"local": {
"type": "Identifier",
"start": 12,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 17
},
"identifierName": "THREE"
},
"name": "THREE"
}
}
],
"source": {
"type": "StringLiteral",
"start": 23,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 23
},
"end": {
"line": 1,
"column": 30
}
},
"extra": {
"rawValue": "three",
"raw": "'three'"
},
"value": "three"
}
},
{
"type": "FunctionDeclaration",
"start": 33,
"end": 93,
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 5,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 42,
"end": 49,
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 16
},
"identifierName": "cross2d"
},
"name": "cross2d"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 50,
"end": 51,
"loc": {
"start": {
"line": 3,
"column": 17
},
"end": {
"line": 3,
"column": 18
},
"identifierName": "a"
},
"name": "a"
},
{
"type": "Identifier",
"start": 53,
"end": 54,
"loc": {
"start": {
"line": 3,
"column": 20
},
"end": {
"line": 3,
"column": 21
},
"identifierName": "b"
},
"name": "b"
}
],
"body": {
"type": "BlockStatement",
"start": 56,
"end": 93,
"loc": {
"start": {
"line": 3,
"column": 23
},
"end": {
"line": 5,
"column": 1
}
},
"body": [
{
"type": "ReturnStatement",
"start": 62,
"end": 91,
"loc": {
"start": {
"line": 4,
"column": 4
},
"end": {
"line": 4,
"column": 33
}
},
"argument": {
"type": "BinaryExpression",
"start": 69,
"end": 90,
"loc": {
"start": {
"line": 4,
"column": 11
},
"end": {
"line": 4,
"column": 32
}
},
"left": {
"type": "BinaryExpression",
"start": 69,
"end": 78,
"loc": {
"start": {
"line": 4,
"column": 11
},
"end": {
"line": 4,
"column": 20
}
},
"left": {
"type": "MemberExpression",
"start": 69,
"end": 72,
"loc": {
"start": {
"line": 4,
"column": 11
},
"end": {
"line": 4,
"column": 14
}
},
"object": {
"type": "Identifier",
"start": 69,
"end": 70,
"loc": {
"start": {
"line": 4,
"column": 11
},
"end": {
"line": 4,
"column": 12
},
"identifierName": "a"
},
"name": "a"
},
"property": {
"type": "Identifier",
"start": 71,
"end": 72,
"loc": {
"start": {
"line": 4,
"column": 13
},
"end": {
"line": 4,
"column": 14
},
"identifierName": "x"
},
"name": "x"
},
"computed": false
},
"operator": "*",
"right": {
"type": "MemberExpression",
"start": 75,
"end": 78,
"loc": {
"start": {
"line": 4,
"column": 17
},
"end": {
"line": 4,
"column": 20
}
},
"object": {
"type": "Identifier",
"start": 75,
"end": 76,
"loc": {
"start": {
"line": 4,
"column": 17
},
"end": {
"line": 4,
"column": 18
},
"identifierName": "b"
},
"name": "b"
},
"property": {
"type": "Identifier",
"start": 77,
"end": 78,
"loc": {
"start": {
"line": 4,
"column": 19
},
"end": {
"line": 4,
"column": 20
},
"identifierName": "y"
},
"name": "y"
},
"computed": false
}
},
"operator": "-",
"right": {
"type": "BinaryExpression",
"start": 81,
"end": 90,
"loc": {
"start": {
"line": 4,
"column": 23
},
"end": {
"line": 4,
"column": 32
}
},
"left": {
"type": "MemberExpression",
"start": 81,
"end": 84,
"loc": {
"start": {
"line": 4,
"column": 23
},
"end": {
"line": 4,
"column": 26
}
},
"object": {
"type": "Identifier",
"start": 81,
"end": 82,
"loc": {
"start": {
"line": 4,
"column": 23
},
"end": {
"line": 4,
"column": 24
},
"identifierName": "a"
},
"name": "a"
},
"property": {
"type": "Identifier",
"start": 83,
"end": 84,
"loc": {
"start": {
"line": 4,
"column": 25
},
"end": {
"line": 4,
"column": 26
},
"identifierName": "y"
},
"name": "y"
},
"computed": false
},
"operator": "*",
"right": {
"type": "MemberExpression",
"start": 87,
"end": 90,
"loc": {
"start": {
"line": 4,
"column": 29
},
"end": {
"line": 4,
"column": 32
}
},
"object": {
"type": "Identifier",
"start": 87,
"end": 88,
"loc": {
"start": {
"line": 4,
"column": 29
},
"end": {
"line": 4,
"column": 30
},
"identifierName": "b"
},
"name": "b"
},
"property": {
"type": "Identifier",
"start": 89,
"end": 90,
"loc": {
"start": {
"line": 4,
"column": 31
},
"end": {
"line": 4,
"column": 32
},
"identifierName": "x"
},
"name": "x"
},
"computed": false
}
}
}
}
],
"directives": []
}
},
{
"type": "ExportNamedDeclaration",
"start": 95,
"end": 915,
"loc": {
"start": {
"line": 7,
"column": 0
},
"end": {
"line": 24,
"column": 1
}
},
"specifiers": [],
"source": null,
"declaration": {
"type": "FunctionDeclaration",
"start": 102,
"end": 915,
"loc": {
"start": {
"line": 7,
"column": 7
},
"end": {
"line": 24,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 111,
"end": 126,
"loc": {
"start": {
"line": 7,
"column": 16
},
"end": {
"line": 7,
"column": 31
},
"identifierName": "drawArcBy_S_T_E"
},
"name": "drawArcBy_S_T_E"
},
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 127,
"end": 135,
"loc": {
"start": {
"line": 7,
"column": 32
},
"end": {
"line": 7,
"column": 40
},
"identifierName": "startPos"
},
"name": "startPos"
},
{
"type": "Identifier",
"start": 137,
"end": 149,
"loc": {
"start": {
"line": 7,
"column": 42
},
"end": {
"line": 7,
"column": 54
},
"identifierName": "startTangent"
},
"name": "startTangent"
},
{
"type": "Identifier",
"start": 151,
"end": 157,
"loc": {
"start": {
"line": 7,
"column": 56
},
"end": {
"line": 7,
"column": 62
},
"identifierName": "endPos"
},
"name": "endPos"
}
],
"body": {
"type": "BlockStatement",
"start": 159,
"end": 915,
"loc": {
"start": {
"line": 7,
"column": 64
},
"end": {
"line": 24,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 205,
"end": 244,
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 9,
"column": 43
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 209,
"end": 243,
"loc": {
"start": {
"line": 9,
"column": 8
},
"end": {
"line": 9,
"column": 42
}
},
"id": {
"type": "Identifier",
"start": 209,
"end": 212,
"loc": {
"start": {
"line": 9,
"column": 8
},
"end": {
"line": 9,
"column": 11
},
"identifierName": "dir"
},
"name": "dir",
"leadingComments": null
},
"init": {
"type": "CallExpression",
"start": 215,
"end": 243,
"loc": {
"start": {
"line": 9,
"column": 14
},
"end": {
"line": 9,
"column": 42
}
},
"callee": {
"type": "MemberExpression",
"start": 215,
"end": 233,
"loc": {
"start": {
"line": 9,
"column": 14
},
"end": {
"line": 9,
"column": 32
}
},
"object": {
"type": "CallExpression",
"start": 215,
"end": 229,
"loc": {
"start": {
"line": 9,
"column": 14
},
"end": {
"line": 9,
"column": 28
}
},
"callee": {
"type": "MemberExpression",
"start": 215,
"end": 227,
"loc": {
"start": {
"line": 9,
"column": 14
},
"end": {
"line": 9,
"column": 26
}
},
"object": {
"type": "Identifier",
"start": 215,
"end": 221,
"loc": {
"start": {
"line": 9,
"column": 14
},
"end": {
"line": 9,
"column": 20
},
"identifierName": "endPos"
},
"name": "endPos"
},
"property": {
"type": "Identifier",
"start": 222,
"end": 227,
"loc": {
"start": {
"line": 9,
"column": 21
},
"end": {
"line": 9,
"column": 26
},
"identifierName": "clone"
},
"name": "clone"
},
"computed": false
},
"arguments": []
},
"property": {
"type": "Identifier",
"start": 230,
"end": 233,
"loc": {
"start": {
"line": 9,
"column": 29
},
"end": {
"line": 9,
"column": 32
},
"identifierName": "sub"
},
"name": "sub"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 234,
"end": 242,
"loc": {
"start": {
"line": 9,
"column": 33
},
"end": {
"line": 9,
"column": 41
},
"identifierName": "startPos"
},
"name": "startPos"
}
]
},
"leadingComments": null
}
],
"kind": "var",
"leadingComments": [
{
"type": "CommentLine",
"value": "should we create a line or an arc",
"start": 165,
"end": 200,
"loc": {
"start": {
"line": 8,
"column": 4
},
"end": {
"line": 8,
"column": 39
}
}
}
]
},
{
"type": "VariableDeclaration",
"start": 249,
"end": 326,
"loc": {
"start": {
"line": 10,
"column": 4
},
"end": {
"line": 10,
"column": 81
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 253,
"end": 325,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 10,
"column": 80
}
},
"id": {
"type": "Identifier",
"start": 253,
"end": 259,
"loc": {
"start": {
"line": 10,
"column": 8
},
"end": {
"line": 10,
"column": 14
},
"identifierName": "onLine"
},
"name": "onLine"
},
"init": {
"type": "CallExpression",
"start": 262,
"end": 325,
"loc": {
"start": {
"line": 10,
"column": 17
},
"end": {
"line": 10,
"column": 80
}
},
"callee": {
"type": "MemberExpression",
"start": 262,
"end": 282,
"loc": {
"start": {
"line": 10,
"column": 17
},
"end": {
"line": 10,
"column": 37
}
},
"object": {
"type": "CallExpression",
"start": 262,
"end": 278,
"loc": {
"start": {
"line": 10,
"column": 17
},
"end": {
"line": 10,
"column": 33
}
},
"callee": {
"type": "MemberExpression",
"start": 262,
"end": 276,
"loc": {
"start": {
"line": 10,
"column": 17
},
"end": {
"line": 10,
"column": 31
}
},
"object": {
"type": "Identifier",
"start": 262,
"end": 270,
"loc": {
"start": {
"line": 10,
"column": 17
},
"end": {
"line": 10,
"column": 25
},
"identifierName": "startPos"
},
"name": "startPos"
},
"property": {
"type": "Identifier",
"start": 271,
"end": 276,
"loc": {
"start": {
"line": 10,
"column": 26
},
"end": {
"line": 10,
"column": 31
},
"identifierName": "clone"
},
"name": "clone"
},
"computed": false
},
"arguments": []
},
"property": {
"type": "Identifier",
"start": 279,
"end": 282,
"loc": {
"start": {
"line": 10,
"column": 34
},
"end": {
"line": 10,
"column": 37
},
"identifierName": "add"
},
"name": "add"
},
"computed": false
},
"arguments": [
{
"type": "CallExpression",
"start": 283,
"end": 324,
"loc": {
"start": {
"line": 10,
"column": 38
},
"end": {
"line": 10,
"column": 79
}
},
"callee": {
"type": "MemberExpression",
"start": 283,
"end": 310,
"loc": {
"start": {
"line": 10,
"column": 38
},
"end": {
"line": 10,
"column": 65
}
},
"object": {
"type": "CallExpression",
"start": 283,
"end": 294,
"loc": {
"start": {
"line": 10,
"column": 38
},
"end": {
"line": 10,
"column": 49
}
},
"callee": {
"type": "MemberExpression",
"start": 283,
"end": 292,
"loc": {
"start": {
"line": 10,
"column": 38
},
"end": {
"line": 10,
"column": 47
}
},
"object": {
"type": "Identifier",
"start": 283,
"end": 286,
"loc": {
"start": {
"line": 10,
"column": 38
},
"end": {
"line": 10,
"column": 41
},
"identifierName": "dir"
},
"name": "dir"
},
"property": {
"type": "Identifier",
"start": 287,
"end": 292,
"loc": {
"start": {
"line": 10,
"column": 42
},
"end": {
"line": 10,
"column": 47
},
"identifierName": "clone"
},
"name": "clone"
},
"computed": false
},
"arguments": []
},
"property": {
"type": "Identifier",
"start": 295,
"end": 310,
"loc": {
"start": {
"line": 10,
"column": 50
},
"end": {
"line": 10,
"column": 65
},
"identifierName": "projectOnVector"
},
"name": "projectOnVector"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 311,
"end": 323,
"loc": {
"start": {
"line": 10,
"column": 66
},
"end": {
"line": 10,
"column": 78
},
"identifierName": "startTangent"
},
"name": "startTangent"
}
]
}
]
}
}
],
"kind": "var"
},
{
"type": "VariableDeclaration",
"start": 331,
"end": 370,
"loc": {
"start": {
"line": 11,
"column": 4
},
"end": {
"line": 11,
"column": 43
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 335,
"end": 369,
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 42
}
},
"id": {
"type": "Identifier",
"start": 335,
"end": 341,
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 14
},
"identifierName": "height"
},
"name": "height"
},
"init": {
"type": "CallExpression",
"start": 344,
"end": 369,
"loc": {
"start": {
"line": 11,
"column": 17
},
"end": {
"line": 11,
"column": 42
}
},
"callee": {
"type": "MemberExpression",
"start": 344,
"end": 361,
"loc": {
"start": {
"line": 11,
"column": 17
},
"end": {
"line": 11,
"column": 34
}
},
"object": {
"type": "Identifier",
"start": 344,
"end": 350,
"loc": {
"start": {
"line": 11,
"column": 17
},
"end": {
"line": 11,
"column": 23
},
"identifierName": "onLine"
},
"name": "onLine"
},
"property": {
"type": "Identifier",
"start": 351,
"end": 361,
"loc": {
"start": {
"line": 11,
"column": 24
},
"end": {
"line": 11,
"column": 34
},
"identifierName": "distanceTo"
},
"name": "distanceTo"
},
"computed": false
},
"arguments": [
{
"type": "Identifier",
"start": 362,
"end": 368,
"loc": {
"start": {
"line": 11,
"column": 35
},
"end": {
"line": 11,
"column": 41
},
"identifierName": "endPos"
},
"name": "endPos"
}
]
}
}
],
"kind": "var"
},
{
"type": "VariableDeclaration",
"start": 375,
"end": 429,
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 12,
"column": 58
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 379,
"end": 428,
"loc": {
"start": {
"line": 12,
"column": 8
},
"end": {
"line": 12,
"column": 57
}
},
"id": {
"type": "Identifier",
"start": 379,
"end": 387,
"loc": {
"start": {
"line": 12,
"column": 8
},
"end": {
"line": 12,
"column": 16
},
"identifierName": "isLinear"
},
"name": "isLinear"
},
"init": {
"type": "BinaryExpression",
"start": 391,
"end": 427,
"loc": {
"start": {
"line": 12,
"column": 20
},
"end": {
"line": 12,
"column": 56
}
},
"left": {
"type": "Identifier",
"start": 391,
"end": 397,
"loc": {
"start": {
"line": 12,
"column": 20
},
"end": {
"line": 12,
"column": 26
},
"identifierName": "height"
},
"name": "height"
},
"operator": "<=",
"right": {
"type": "BinaryExpression",
"start": 401,
"end": 427,
"loc": {
"start": {
"line": 12,
"column": 30
},
"end": {
"line": 12,
"column": 56
}
},
"left": {
"type": "BinaryExpression",
"start": 401,
"end": 420,
"loc": {
"start": {
"line": 12,
"column": 30
},
"end": {
"line": 12,
"column": 49
}
},
"left": {
"type": "CallExpression",
"start": 401,
"end": 413,
"loc": {
"start": {
"line": 12,
"column": 30
},
"end": {
"line": 12,
"column": 42
}
},
"callee": {
"type": "MemberExpression",
"start": 401,
"end": 411,
"loc": {
"start": {
"line": 12,
"column": 30
},
"end": {
"line": 12,
"column": 40
}
},
"object": {
"type": "Identifier",
"start": 401,
"end": 404,
"loc": {
"start": {
"line": 12,
"column": 30
},
"end": {
"line": 12,
"column": 33
},
"identifierName": "dir"
},
"name": "dir"
},
"property": {
"type": "Identifier",
"start": 405,
"end": 411,
"loc": {
"start": {
"line": 12,
"column": 34
},
"end": {
"line": 12,
"column": 40
},
"identifierName": "length"
},
"name": "length"
},
"computed": false
},
"arguments": []
},
"operator": "*",
"right": {
"type": "NumericLiteral",
"start": 416,
"end": 420,
"loc": {
"start": {
"line": 12,
"column": 45
},
"end": {
"line": 12,
"column": 49
}
},
"extra": {
"rawValue": 0.001,
"raw": "1e-3"
},
"value": 0.001
}
},
"operator": "+",
"right": {
"type": "NumericLiteral",
"start": 423,
"end": 427,
"loc": {
"start": {
"line": 12,
"column": 52
},
"end": {
"line": 12,
"column": 56
}
},
"extra": {
"rawValue": 0.001,
"raw": "1e-3"
},
"value": 0.001
}
},
"extra": {
"parenthesized": true,
"parenStart": 390
}
}
}
],
"kind": "var"
},
{
"type": "IfStatement",
"start": 435,
"end": 913,
"loc": {
"start": {
"line": 14,
"column": 4
},
"end": {
"line": 23,
"column": 5
}
},
"test": {
"type": "Identifier",
"start": 439,
"end": 447,
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 16
},
"identifierName": "isLinear"
},
"name": "isLinear"
},
"consequent": {
"type": "ReturnStatement",
"start": 457,
"end": 495,
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 46
}
},
"argument": {
"type": "ObjectExpression",
"start": 464,
"end": 494,
"loc": {
"start": {
"line": 15,
"column": 15
},
"end": {
"line": 15,
"column": 45
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 465,
"end": 480,
"loc": {
"start": {
"line": 15,
"column": 16
},
"end": {
"line": 15,
"column": 31
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 46