UNPKG

awv3

Version:
1,774 lines 81 kB
{ "type": "File", "start": 0, "end": 476, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 13, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 476, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 13, "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": "ExportNamedDeclaration", "start": 35, "end": 474, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 12, "column": 1 } }, "specifiers": [], "source": null, "declaration": { "type": "FunctionDeclaration", "start": 42, "end": 474, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 12, "column": 1 } }, "id": { "type": "Identifier", "start": 51, "end": 64, "loc": { "start": { "line": 3, "column": 16 }, "end": { "line": 3, "column": 29 }, "identifierName": "calcSketchPos" }, "name": "calcSketchPos" }, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 65, "end": 68, "loc": { "start": { "line": 3, "column": 30 }, "end": { "line": 3, "column": 33 }, "identifierName": "ray" }, "name": "ray" }, { "type": "Identifier", "start": 70, "end": 76, "loc": { "start": { "line": 3, "column": 35 }, "end": { "line": 3, "column": 41 }, "identifierName": "sketch" }, "name": "sketch" } ], "body": { "type": "BlockStatement", "start": 78, "end": 474, "loc": { "start": { "line": 3, "column": 43 }, "end": { "line": 12, "column": 1 } }, "body": [ { "type": "VariableDeclaration", "start": 135, "end": 207, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 76 } }, "declarations": [ { "type": "VariableDeclarator", "start": 141, "end": 206, "loc": { "start": { "line": 5, "column": 10 }, "end": { "line": 5, "column": 75 } }, "id": { "type": "Identifier", "start": 141, "end": 153, "loc": { "start": { "line": 5, "column": 10 }, "end": { "line": 5, "column": 22 }, "identifierName": "worldToLocal" }, "name": "worldToLocal", "leadingComments": null }, "init": { "type": "CallExpression", "start": 156, "end": 206, "loc": { "start": { "line": 5, "column": 25 }, "end": { "line": 5, "column": 75 } }, "callee": { "type": "MemberExpression", "start": 156, "end": 186, "loc": { "start": { "line": 5, "column": 25 }, "end": { "line": 5, "column": 55 } }, "object": { "type": "NewExpression", "start": 156, "end": 175, "loc": { "start": { "line": 5, "column": 25 }, "end": { "line": 5, "column": 44 } }, "callee": { "type": "MemberExpression", "start": 160, "end": 173, "loc": { "start": { "line": 5, "column": 29 }, "end": { "line": 5, "column": 42 } }, "object": { "type": "Identifier", "start": 160, "end": 165, "loc": { "start": { "line": 5, "column": 29 }, "end": { "line": 5, "column": 34 }, "identifierName": "THREE" }, "name": "THREE" }, "property": { "type": "Identifier", "start": 166, "end": 173, "loc": { "start": { "line": 5, "column": 35 }, "end": { "line": 5, "column": 42 }, "identifierName": "Matrix4" }, "name": "Matrix4" }, "computed": false }, "arguments": [] }, "property": { "type": "Identifier", "start": 176, "end": 186, "loc": { "start": { "line": 5, "column": 45 }, "end": { "line": 5, "column": 55 }, "identifierName": "getInverse" }, "name": "getInverse" }, "computed": false }, "arguments": [ { "type": "MemberExpression", "start": 187, "end": 205, "loc": { "start": { "line": 5, "column": 56 }, "end": { "line": 5, "column": 74 } }, "object": { "type": "Identifier", "start": 187, "end": 193, "loc": { "start": { "line": 5, "column": 56 }, "end": { "line": 5, "column": 62 }, "identifierName": "sketch" }, "name": "sketch" }, "property": { "type": "Identifier", "start": 194, "end": 205, "loc": { "start": { "line": 5, "column": 63 }, "end": { "line": 5, "column": 74 }, "identifierName": "matrixWorld" }, "name": "matrixWorld" }, "computed": false } ] }, "leadingComments": null } ], "kind": "const", "leadingComments": [ { "type": "CommentLine", "value": "transform line from world to sketch coords", "start": 85, "end": 129, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 48 } } } ] }, { "type": "ExpressionStatement", "start": 213, "end": 244, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 35 } }, "expression": { "type": "CallExpression", "start": 213, "end": 243, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 34 } }, "callee": { "type": "MemberExpression", "start": 213, "end": 229, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 20 } }, "object": { "type": "Identifier", "start": 213, "end": 216, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 7 }, "identifierName": "ray" }, "name": "ray" }, "property": { "type": "Identifier", "start": 217, "end": 229, "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 20 }, "identifierName": "applyMatrix4" }, "name": "applyMatrix4" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 230, "end": 242, "loc": { "start": { "line": 6, "column": 21 }, "end": { "line": 6, "column": 33 }, "identifierName": "worldToLocal" }, "name": "worldToLocal" } ] }, "trailingComments": [ { "type": "CommentLine", "value": "calculate intersection of line with z = 0 plane", "start": 250, "end": 299, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 53 } } } ] }, { "type": "VariableDeclaration", "start": 305, "end": 356, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 55 } }, "declarations": [ { "type": "VariableDeclarator", "start": 311, "end": 355, "loc": { "start": { "line": 8, "column": 10 }, "end": { "line": 8, "column": 54 } }, "id": { "type": "Identifier", "start": 311, "end": 316, "loc": { "start": { "line": 8, "column": 10 }, "end": { "line": 8, "column": 15 }, "identifierName": "param" }, "name": "param", "leadingComments": null }, "init": { "type": "BinaryExpression", "start": 319, "end": 355, "loc": { "start": { "line": 8, "column": 18 }, "end": { "line": 8, "column": 54 } }, "left": { "type": "BinaryExpression", "start": 320, "end": 336, "loc": { "start": { "line": 8, "column": 19 }, "end": { "line": 8, "column": 35 } }, "left": { "type": "NumericLiteral", "start": 320, "end": 321, "loc": { "start": { "line": 8, "column": 19 }, "end": { "line": 8, "column": 20 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 }, "operator": "-", "right": { "type": "MemberExpression", "start": 324, "end": 336, "loc": { "start": { "line": 8, "column": 23 }, "end": { "line": 8, "column": 35 } }, "object": { "type": "MemberExpression", "start": 324, "end": 334, "loc": { "start": { "line": 8, "column": 23 }, "end": { "line": 8, "column": 33 } }, "object": { "type": "Identifier", "start": 324, "end": 327, "loc": { "start": { "line": 8, "column": 23 }, "end": { "line": 8, "column": 26 }, "identifierName": "ray" }, "name": "ray" }, "property": { "type": "Identifier", "start": 328, "end": 334, "loc": { "start": { "line": 8, "column": 27 }, "end": { "line": 8, "column": 33 }, "identifierName": "origin" }, "name": "origin" }, "computed": false }, "property": { "type": "Identifier", "start": 335, "end": 336, "loc": { "start": { "line": 8, "column": 34 }, "end": { "line": 8, "column": 35 }, "identifierName": "z" }, "name": "z" }, "computed": false }, "extra": { "parenthesized": true, "parenStart": 319 } }, "operator": "/", "right": { "type": "MemberExpression", "start": 340, "end": 355, "loc": { "start": { "line": 8, "column": 39 }, "end": { "line": 8, "column": 54 } }, "object": { "type": "MemberExpression", "start": 340, "end": 353, "loc": { "start": { "line": 8, "column": 39 }, "end": { "line": 8, "column": 52 } }, "object": { "type": "Identifier", "start": 340, "end": 343, "loc": { "start": { "line": 8, "column": 39 }, "end": { "line": 8, "column": 42 }, "identifierName": "ray" }, "name": "ray" }, "property": { "type": "Identifier", "start": 344, "end": 353, "loc": { "start": { "line": 8, "column": 43 }, "end": { "line": 8, "column": 52 }, "identifierName": "direction" }, "name": "direction" }, "computed": false }, "property": { "type": "Identifier", "start": 354, "end": 355, "loc": { "start": { "line": 8, "column": 53 }, "end": { "line": 8, "column": 54 }, "identifierName": "z" }, "name": "z" }, "computed": false } }, "leadingComments": null } ], "kind": "const", "leadingComments": [ { "type": "CommentLine", "value": "calculate intersection of line with z = 0 plane", "start": 250, "end": 299, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 53 } } } ] }, { "type": "VariableDeclaration", "start": 362, "end": 394, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 36 } }, "declarations": [ { "type": "VariableDeclarator", "start": 366, "end": 393, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 9, "column": 35 } }, "id": { "type": "Identifier", "start": 366, "end": 377, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 9, "column": 19 }, "identifierName": "sketchPoint" }, "name": "sketchPoint" }, "init": { "type": "CallExpression", "start": 380, "end": 393, "loc": { "start": { "line": 9, "column": 22 }, "end": { "line": 9, "column": 35 } }, "callee": { "type": "MemberExpression", "start": 380, "end": 386, "loc": { "start": { "line": 9, "column": 22 }, "end": { "line": 9, "column": 28 } }, "object": { "type": "Identifier", "start": 380, "end": 383, "loc": { "start": { "line": 9, "column": 22 }, "end": { "line": 9, "column": 25 }, "identifierName": "ray" }, "name": "ray" }, "property": { "type": "Identifier", "start": 384, "end": 386, "loc": { "start": { "line": 9, "column": 26 }, "end": { "line": 9, "column": 28 }, "identifierName": "at" }, "name": "at" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 387, "end": 392, "loc": { "start": { "line": 9, "column": 29 }, "end": { "line": 9, "column": 34 }, "identifierName": "param" }, "name": "param" } ] } } ], "kind": "let" }, { "type": "ExpressionStatement", "start": 400, "end": 418, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 22 } }, "expression": { "type": "AssignmentExpression", "start": 400, "end": 417, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 21 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 400, "end": 413, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 17 } }, "object": { "type": "Identifier", "start": 400, "end": 411, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 15 }, "identifierName": "sketchPoint" }, "name": "sketchPoint" }, "property": { "type": "Identifier", "start": 412, "end": 413, "loc": { "start": { "line": 10, "column": 16 }, "end": { "line": 10, "column": 17 }, "identifierName": "z" }, "name": "z" }, "computed": false }, "right": { "type": "NumericLiteral", "start": 416, "end": 417, "loc": { "start": { "line": 10, "column": 20 }, "end": { "line": 10, "column": 21 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 } }, "trailingComments": [ { "type": "CommentLine", "value": "ensure it is exactly zero", "start": 419, "end": 446, "loc": { "start": { "line": 10, "column": 23 }, "end": { "line": 10, "column": 50 } } } ] }, { "type": "ReturnStatement", "start": 452, "end": 471, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 23 } }, "argument": { "type": "Identifier", "start": 459, "end": 470, "loc": { "start": { "line": 11, "column": 11 }, "end": { "line": 11, "column": 22 }, "identifierName": "sketchPoint" }, "name": "sketchPoint", "leadingComments": null }, "leadingComments": [ { "type": "CommentLine", "value": "ensure it is exactly zero", "start": 419, "end": 446, "loc": { "start": { "line": 10, "column": 23 }, "end": { "line": 10, "column": 50 } } } ] } ], "directives": [] }, "leadingComments": [], "trailingComments": [] } } ], "directives": [] }, "comments": [ { "type": "CommentLine", "value": "transform line from world to sketch coords", "start": 85, "end": 129, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 48 } } }, { "type": "CommentLine", "value": "calculate intersection of line with z = 0 plane", "start": 250, "end": 299, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 53 } } }, { "type": "CommentLine", "value": "ensure it is exactly zero", "start": 419, "end": 446, "loc": { "start": { "line": 10, "column": 23 }, "end": { "line": 10, "column": 50 } } } ], "tokens": [ { "type": { "label": "import", "keyword": "import", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "import", "start": 0, "end": 6, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 6 } } }, { "type": { "label": "*", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": 10, "updateContext": null }, "value": "*", "start": 7, "end": 8, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 8 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "as", "start": 9, "end": 11, "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 11 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "THREE", "start": 12, "end": 17, "loc": { "start": { "line": 1, "column": 12 }, "end": { "line": 1, "column": 17 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "from", "start": 18, "end": 22, "loc": { "start": { "line": 1, "column": 18 }, "end": { "line": 1, "column": 22 } } }, { "type": { "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "three", "start": 23, "end": 30, "loc": { "start": { "line": 1, "column": 23 }, "end": { "line": 1, "column": 30 } } }, { "type": { "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 30, "end": 31, "loc": { "start": { "line": 1, "column": 30 }, "end": { "line": 1, "column": 31 } } }, { "type": { "label": "export", "keyword": "export", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "export", "start": 35, "end": 41, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 6 } } }, { "type": { "label": "function", "keyword": "function", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "function", "start": 42, "end": 50, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 15 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "calcSketchPos", "start": 51, "end": 64, "loc": { "start": { "line": 3, "column": 16 }, "end": { "line": 3, "column": 29 } } }, { "type": { "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 64, "end": 65, "loc": { "start": { "line": 3, "column": 29 }, "end": { "line": 3, "column": 30 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "ray", "start": 65, "end": 68, "loc": { "start": { "line": 3, "column": 30 }, "end": { "line": 3, "column": 33 } } }, { "type": { "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "start": 68, "end": 69, "loc": { "start": { "line": 3, "column": 33 }, "end": { "line": 3, "column": 34 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "sketch", "start": 70, "end": 76, "loc": { "start": { "line": 3, "column": 35 }, "end": { "line": 3, "column": 41 } } }, { "type": { "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 76, "end": 77, "loc": { "start": { "line": 3, "column": 41 }, "end": { "line": 3, "column": 42 } } }, { "type": { "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "start": 78, "end": 79, "loc": { "start": { "line": 3, "column": 43 }, "end": { "line": 3, "column": 44 } } }, { "type": "CommentLine", "value": "transform line from world to sketch coords", "start": 85, "end": 129, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 48 } } }, { "type": { "label": "const", "keyword": "const", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "const", "start": 135, "end": 140, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 9 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "worldToLocal", "start": 141, "end": 153, "loc": { "start": { "line": 5, "column": 10 }, "end": { "line": 5, "column": 22 } } }, { "type": { "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "=", "start": 154, "end": 155, "loc": { "start": { "line": 5, "column": 23 }, "end": { "line": 5, "column": 24 } } }, { "type": { "label": "new", "keyword": "new", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, "value": "new", "start": 156, "end": 159, "loc": { "start": { "line": 5, "column": 25 }, "end": { "line": 5, "column": 28 } } }, { "type": { "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, "value": "THREE", "start": 160, "end": 165, "loc": { "start": { "line": 5, "column":