UNPKG

awv3

Version:
1,774 lines 81 kB
{ "type": "File", "start": 0, "end": 465, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 13, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 465, "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": 33, "end": 464, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 12, "column": 1 } }, "specifiers": [], "source": null, "declaration": { "type": "FunctionDeclaration", "start": 40, "end": 464, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 12, "column": 1 } }, "id": { "type": "Identifier", "start": 49, "end": 62, "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": 63, "end": 66, "loc": { "start": { "line": 3, "column": 30 }, "end": { "line": 3, "column": 33 }, "identifierName": "ray" }, "name": "ray" }, { "type": "Identifier", "start": 68, "end": 74, "loc": { "start": { "line": 3, "column": 35 }, "end": { "line": 3, "column": 41 }, "identifierName": "sketch" }, "name": "sketch" } ], "body": { "type": "BlockStatement", "start": 76, "end": 464, "loc": { "start": { "line": 3, "column": 43 }, "end": { "line": 12, "column": 1 } }, "body": [ { "type": "VariableDeclaration", "start": 131, "end": 203, "loc": { "start": { "line": 5, "column": 4 }, "end": { "line": 5, "column": 76 } }, "declarations": [ { "type": "VariableDeclarator", "start": 137, "end": 202, "loc": { "start": { "line": 5, "column": 10 }, "end": { "line": 5, "column": 75 } }, "id": { "type": "Identifier", "start": 137, "end": 149, "loc": { "start": { "line": 5, "column": 10 }, "end": { "line": 5, "column": 22 }, "identifierName": "worldToLocal" }, "name": "worldToLocal", "leadingComments": null }, "init": { "type": "CallExpression", "start": 152, "end": 202, "loc": { "start": { "line": 5, "column": 25 }, "end": { "line": 5, "column": 75 } }, "callee": { "type": "MemberExpression", "start": 152, "end": 182, "loc": { "start": { "line": 5, "column": 25 }, "end": { "line": 5, "column": 55 } }, "object": { "type": "NewExpression", "start": 152, "end": 171, "loc": { "start": { "line": 5, "column": 25 }, "end": { "line": 5, "column": 44 } }, "callee": { "type": "MemberExpression", "start": 156, "end": 169, "loc": { "start": { "line": 5, "column": 29 }, "end": { "line": 5, "column": 42 } }, "object": { "type": "Identifier", "start": 156, "end": 161, "loc": { "start": { "line": 5, "column": 29 }, "end": { "line": 5, "column": 34 }, "identifierName": "THREE" }, "name": "THREE" }, "property": { "type": "Identifier", "start": 162, "end": 169, "loc": { "start": { "line": 5, "column": 35 }, "end": { "line": 5, "column": 42 }, "identifierName": "Matrix4" }, "name": "Matrix4" }, "computed": false }, "arguments": [] }, "property": { "type": "Identifier", "start": 172, "end": 182, "loc": { "start": { "line": 5, "column": 45 }, "end": { "line": 5, "column": 55 }, "identifierName": "getInverse" }, "name": "getInverse" }, "computed": false }, "arguments": [ { "type": "MemberExpression", "start": 183, "end": 201, "loc": { "start": { "line": 5, "column": 56 }, "end": { "line": 5, "column": 74 } }, "object": { "type": "Identifier", "start": 183, "end": 189, "loc": { "start": { "line": 5, "column": 56 }, "end": { "line": 5, "column": 62 }, "identifierName": "sketch" }, "name": "sketch" }, "property": { "type": "Identifier", "start": 190, "end": 201, "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": 82, "end": 126, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 48 } } } ] }, { "type": "ExpressionStatement", "start": 208, "end": 239, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 35 } }, "expression": { "type": "CallExpression", "start": 208, "end": 238, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 34 } }, "callee": { "type": "MemberExpression", "start": 208, "end": 224, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 20 } }, "object": { "type": "Identifier", "start": 208, "end": 211, "loc": { "start": { "line": 6, "column": 4 }, "end": { "line": 6, "column": 7 }, "identifierName": "ray" }, "name": "ray" }, "property": { "type": "Identifier", "start": 212, "end": 224, "loc": { "start": { "line": 6, "column": 8 }, "end": { "line": 6, "column": 20 }, "identifierName": "applyMatrix4" }, "name": "applyMatrix4" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 225, "end": 237, "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": 244, "end": 293, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 53 } } } ] }, { "type": "VariableDeclaration", "start": 298, "end": 349, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 55 } }, "declarations": [ { "type": "VariableDeclarator", "start": 304, "end": 348, "loc": { "start": { "line": 8, "column": 10 }, "end": { "line": 8, "column": 54 } }, "id": { "type": "Identifier", "start": 304, "end": 309, "loc": { "start": { "line": 8, "column": 10 }, "end": { "line": 8, "column": 15 }, "identifierName": "param" }, "name": "param", "leadingComments": null }, "init": { "type": "BinaryExpression", "start": 312, "end": 348, "loc": { "start": { "line": 8, "column": 18 }, "end": { "line": 8, "column": 54 } }, "left": { "type": "BinaryExpression", "start": 313, "end": 329, "loc": { "start": { "line": 8, "column": 19 }, "end": { "line": 8, "column": 35 } }, "left": { "type": "NumericLiteral", "start": 313, "end": 314, "loc": { "start": { "line": 8, "column": 19 }, "end": { "line": 8, "column": 20 } }, "extra": { "rawValue": 0, "raw": "0" }, "value": 0 }, "operator": "-", "right": { "type": "MemberExpression", "start": 317, "end": 329, "loc": { "start": { "line": 8, "column": 23 }, "end": { "line": 8, "column": 35 } }, "object": { "type": "MemberExpression", "start": 317, "end": 327, "loc": { "start": { "line": 8, "column": 23 }, "end": { "line": 8, "column": 33 } }, "object": { "type": "Identifier", "start": 317, "end": 320, "loc": { "start": { "line": 8, "column": 23 }, "end": { "line": 8, "column": 26 }, "identifierName": "ray" }, "name": "ray" }, "property": { "type": "Identifier", "start": 321, "end": 327, "loc": { "start": { "line": 8, "column": 27 }, "end": { "line": 8, "column": 33 }, "identifierName": "origin" }, "name": "origin" }, "computed": false }, "property": { "type": "Identifier", "start": 328, "end": 329, "loc": { "start": { "line": 8, "column": 34 }, "end": { "line": 8, "column": 35 }, "identifierName": "z" }, "name": "z" }, "computed": false }, "extra": { "parenthesized": true, "parenStart": 312 } }, "operator": "/", "right": { "type": "MemberExpression", "start": 333, "end": 348, "loc": { "start": { "line": 8, "column": 39 }, "end": { "line": 8, "column": 54 } }, "object": { "type": "MemberExpression", "start": 333, "end": 346, "loc": { "start": { "line": 8, "column": 39 }, "end": { "line": 8, "column": 52 } }, "object": { "type": "Identifier", "start": 333, "end": 336, "loc": { "start": { "line": 8, "column": 39 }, "end": { "line": 8, "column": 42 }, "identifierName": "ray" }, "name": "ray" }, "property": { "type": "Identifier", "start": 337, "end": 346, "loc": { "start": { "line": 8, "column": 43 }, "end": { "line": 8, "column": 52 }, "identifierName": "direction" }, "name": "direction" }, "computed": false }, "property": { "type": "Identifier", "start": 347, "end": 348, "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": 244, "end": 293, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 53 } } } ] }, { "type": "VariableDeclaration", "start": 354, "end": 386, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 36 } }, "declarations": [ { "type": "VariableDeclarator", "start": 358, "end": 385, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 9, "column": 35 } }, "id": { "type": "Identifier", "start": 358, "end": 369, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 9, "column": 19 }, "identifierName": "sketchPoint" }, "name": "sketchPoint" }, "init": { "type": "CallExpression", "start": 372, "end": 385, "loc": { "start": { "line": 9, "column": 22 }, "end": { "line": 9, "column": 35 } }, "callee": { "type": "MemberExpression", "start": 372, "end": 378, "loc": { "start": { "line": 9, "column": 22 }, "end": { "line": 9, "column": 28 } }, "object": { "type": "Identifier", "start": 372, "end": 375, "loc": { "start": { "line": 9, "column": 22 }, "end": { "line": 9, "column": 25 }, "identifierName": "ray" }, "name": "ray" }, "property": { "type": "Identifier", "start": 376, "end": 378, "loc": { "start": { "line": 9, "column": 26 }, "end": { "line": 9, "column": 28 }, "identifierName": "at" }, "name": "at" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 379, "end": 384, "loc": { "start": { "line": 9, "column": 29 }, "end": { "line": 9, "column": 34 }, "identifierName": "param" }, "name": "param" } ] } } ], "kind": "let" }, { "type": "ExpressionStatement", "start": 391, "end": 409, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 22 } }, "expression": { "type": "AssignmentExpression", "start": 391, "end": 408, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 21 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 391, "end": 404, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 17 } }, "object": { "type": "Identifier", "start": 391, "end": 402, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 15 }, "identifierName": "sketchPoint" }, "name": "sketchPoint" }, "property": { "type": "Identifier", "start": 403, "end": 404, "loc": { "start": { "line": 10, "column": 16 }, "end": { "line": 10, "column": 17 }, "identifierName": "z" }, "name": "z" }, "computed": false }, "right": { "type": "NumericLiteral", "start": 407, "end": 408, "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": 411, "end": 438, "loc": { "start": { "line": 10, "column": 24 }, "end": { "line": 10, "column": 51 } } } ] }, { "type": "ReturnStatement", "start": 443, "end": 462, "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 23 } }, "argument": { "type": "Identifier", "start": 450, "end": 461, "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": 411, "end": 438, "loc": { "start": { "line": 10, "column": 24 }, "end": { "line": 10, "column": 51 } } } ] } ], "directives": [] }, "leadingComments": [], "trailingComments": [] } } ], "directives": [] }, "comments": [ { "type": "CommentLine", "value": "transform line from world to sketch coords", "start": 82, "end": 126, "loc": { "start": { "line": 4, "column": 4 }, "end": { "line": 4, "column": 48 } } }, { "type": "CommentLine", "value": "calculate intersection of line with z = 0 plane", "start": 244, "end": 293, "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 53 } } }, { "type": "CommentLine", "value": "ensure it is exactly zero", "start": 411, "end": 438, "loc": { "start": { "line": 10, "column": 24 }, "end": { "line": 10, "column": 51 } } } ], "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": 33, "end": 39, "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": 40, "end": 48, "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": 49, "end": 62, "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": 62, "end": 63, "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": 63, "end": 66, "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": 66, "end": 67, "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": 68, "end": 74, "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": 74, "end": 75, "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": 76, "end": 77, "loc": { "start": { "line": 3, "column": 43 }, "end": { "line": 3, "column": 44 } } }, { "type": "CommentLine", "value": "transform line from world to sketch coords", "start": 82, "end": 126, "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": 131, "end": 136, "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": 137, "end": 149, "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": 150, "end": 151, "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": 152, "end": 155, "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": 156, "end": 161, "loc": { "start": { "line": 5, "column":